kilko.de/tags/ffmpeg
- Change video container
Quickly change a file's container using magic shell syntax.
ffmpeg -i path/to/file.{webm, mp4} - Concatenate videos
Concating several video files with ffmpeg is very straightforward if they all share the same container and codec. Add all input files to a text file listing their relative or absolute paths.
file 'file1.mp4' file 'file2.mp4' ...Run the following.
$ ffmpeg -f concat -safe 0 -i input.txt -c copy output.mp4-safe 0can be omitted if the filepaths are relative. - Create video from image and audio
Technically something simple along the following lines would work.
ffmpeg -i image.png -i audio.mp3 video.mp4This does however create a file with just a single frame, which doesn't really work on YouTube for example. The following creates a video with repeating frames.
ffmpeg -r 1 -loop 1 -i image.png -i audio.mp3 -acodec copy -shortest -vf scale=1280:720 video.mp4Credits go to superuser.com/a/1041820/236423
- Keep subtitles while transcoding
To keep all existent subtitle tracks when transcoding media with ffmpeg, just pass the flag
-map 0:s -c copy, e.g.$ ffmpeg -i /path/to/media.{mkv,mp4} -map 0:s -c copy - Rotate videos
Rotate videos using ffmpeg by transposing them. The command to do so is:
$ ffmpeg -i input.mp4 -vf "transpose=1" output.mp4The possible rotations are the following.
0 = 90CounterCLockwise and Vertical Flip (default) 1 = 90Clockwise 2 = 90CounterClockwise 3 = 90Clockwise and Vertical FlipUse
-vf "transpose=2,transpose=2"for 180 degrees.Credits go to stackoverflow.com/a/9570992/1843020