Media Handling

Handling media files such as pictures and videos is a task that pops up often and Linux has a host of great CLI tools for doing so very quickly and easily. Mastering these tools will allow you to do things like, flipping an .MOV video or scrubbing the exif data of a photo, or resizing a photo to the best resultion under a set size in seconds without interrupting what you were actually trying to accomplish.

The following are commands for tasks I have ran into.

To vertically flip a video and retain its stream settings use a view filter in ffmpeg by doing the following:

ffmpeg -i in.MOV -vf "vflip" -c:a copy out.MOV

To flip a video file that has been flipped to the correct orientation by use of the exif orientation value, run the command twice.

ffmpeg -i in.MOV -vf "vflip" -c:a copy out1.MOV
ffmpeg -i out1.MOV -vf "vflip" -c:a copy out.MOV

When rotating photos its also usually desirable to dump the exif orientation tag. To do this:

exiftool -Orientation= /path/to/file/or/dirs -overwrite_original
convert file.jpg -rotate -90 out.jpg
  • media_handling.txt
  • Last modified: 2019/03/04 19:13
  • (external edit)