Audio / Video *nix Command Line Tricks

root's picture

How to create fast forward (timelapse) video from normal one with ffmpeg without audio:

# ffmpeg -i crap.mov -an -vf setpts=0.20*PTS crap-fast.mov
NOTE: If you want to create the video with sound (remove the -an option), and the encoder is "aac", you must add the options "-strict -2".

How to create a slow motion video from normal one with ffmpeg without audio:

# ffmpeg -i crap.mov -an -vf setpts=2*PTS crap-slow.mov
NOTE: If you want to create the video with sound (remove the -an option), and the encoder is "aac", you must add the options "-strict -2".

More to read about slowing down or speeding up the video, here.

How to join multiple videos together:

1. Create a text file with all their path in it:
$ for vid in $(ls *.MOV); do echo "file '$vid'"; done >vids.txt

$ tail vids.txt 
file '01170531_2651.MOV'
file '01170532_2652.MOV'
file '01170532_2653.MOV'
file '01170532_2654.MOV'
file '01170532_2655.MOV'
file '01170533_2656.MOV'
file '01170533_2657.MOV'
file '01170533_2658.MOV'
file '01170534_2659.MOV'
file '01170534_2660.MOV'

2. Execute ffmpeg as follows:
$ ffmpeg -f concat -i vids.txt -c copy video_draft.mov

How to add watermark to video with ffmpeg without loosing quality:

$ ffmpeg -i video.mov -i watermark.png -filter_complex 'overlay=1400:830' watermarked-video.mov

How to remove the sound of a video with ffmpeg:

$ ffmpeg -i video.mov -vcodec copy -an no-sound-video.mov

How to rotate video with ffpmeg:

$ ffmpeg -i video.mov -c copy -metadata:s:v:0 rotate=90 video-rotated-90derees.mov

How to change the frame rate of a video with ffmpeg:

$ ffmpeg -i 256fps-video.mov -filter:v fps=fps=60 Result-60fps-video.mov

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.

Recent content

root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root