Table of Contents

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.

Flipping Videos

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
rm out1.mov

Rotating Photos

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