Jupyter notebook, ffmpeg, shell commands
Extract Audio from Movie File
Section titled “Extract Audio from Movie File”ffmpeg -i input-video.avi -vn -acodec copy output-audio.aac
ffmpeg -i input.mp4 -vn -acodec pcm_s16le -ar 44100 -ac 2 output.wav
## Execute Shell Commands from Jupyter Notebook
`%%cmd
``<enter shell command to execute>
or
``!<enter command>
`for moviefile in os.listdir("./"):`
`if moviefile.endswith(".mp4"):`
`inputfile = moviefile`
`outputfile = moviefile + ".aac"`
`if os.listdirtdir command = 'ffmpeg -i ' + inputfile + ' -vn -acodec copy ' + outputfile`
`!{command}`
## Using macOS Find and dot_clean
`find . -name ".DS_Store" -type f -print
`find . -name ".DS_Store" -type f -delete
`find . -name "*.DS_Store" -delete
`find . -type d -empty -print
`find . -type d -empty -delete
`find . -mindepth 2 -maxdepth 2 -type d -print
`find . -mindepth 2 -maxdepth 2 -type d -exec echo mv {} . \;
`find . -name ".DS_Store" -type f -delete && find . -type d -empty -delete
### Find All Files that Don't Have One of a Set of Extensions
`find . -type f -print | grep -vE "\.(jpg|png)$"
## Update All Photos' Date Created and Modified to Date Taken
`exiftool "-filemodifydate<datetimeoriginal" "-filecreatedate<datetimeoriginal" [David Bray](../People/David%20Bray.md)Organize Photos into Year / Month Folders
Section titled “Organize Photos into Year / Month Folders”- Download Organize: https://[GitHub](../Organizations/GitHub.md).com/tfeldmann/organize
rules:
- locations: ~/Pictures
filters:
- extension:
- .jpg
- .raf
- exif
actions:
- move: ~/Pictures/Sorted/{exif.exif.datetimeoriginal.year}/{exif.exif.datetimeoriginal.month}/Generate a List of Sequential URLs and Automatically Copy Them to the MacOS Clipboard
Section titled “Generate a List of Sequential URLs and Automatically Copy Them to the MacOS Clipboard”echo <https://www.example.com/file->{001..010}.html | pbcopy