Useful FFmpeg Commands for Working with Audio and Video Files – Digital Inspiration
1 2
A civil engineer with a longlife fondness for Software Libero
Useful FFmpeg Commands for Working with Audio and Video Files – Digital Inspiration
This site uses Akismet to reduce spam. Learn how your comment data is processed.
See also https://williamyaps.blogspot.com/2017/01/ffmpeg-encoding-h264-decrease-size.html for extensive informations of compression settings
From https://superuser.com/questions/1137612/ffmpeg-replace-audio-in-video#1137613
You will want to copy the video stream without re-encoding to save a lot of time but re-encoding the audio might help to prevent incompatibilities:
ffmpeg -i v.mp4 -i a.wav -c:v copy -map 0:v:0 -map 1:a:0 new.mp4
-map 0:v:0 maps the first (index 0) video stream from the input to the first (index 0) video stream in the output.
-map 1:a:0 maps the second (index 1) audio stream from the input to the first (index 0) audio stream in the output.
If the audio is longer than the video, you will want to add -shortest (or possibly -fflags shortest) before the output file name.
Not specifying an audio codec, will automatically select a working one. You can specify one by for example adding -c:a libvorbis after -c:v copy. You can also use -c copy to avoid re-encoding the audio, but this has lead to compatibility and synchronization problems in my past.