From Giki

get video streams information - json format

source: https://gist.github.com/nrk/2286511

ffprobe -v quiet -print_format json -show_format -show_streams "video.mp4"

remove audio from video file

source: https://superuser.com/questions/268985/remove-audio-from-video-file-with-ffmpeg

one has to use the an flag

ffmpeg -i input.mp4 -c copy -an output.mp4


convert mov to mp4

source: https://mrcoles.com/convert-mov-mp4-ffmpeg/

ffmpeg -i video.mov -vcodec h264 -acodec mp2 video.mp4


merge multiple mp4 files

source: https://gist.github.com/usunyu/7d807a69508fc7aff7d8bdad71839f65

cat files.txt
   file '/path/to/file1'
   file '/path/to/file2'
   file '/path/to/file3'

ffmpeg -f concat -safe 0 -i files.txt -c copy output.mp4

or specify the files using `-i`

ffmpeg -f concat -safe 0 -i /path/to/file1 -i /path/to/file2 -i /path/to/file3 -c copy output.mp4

because of error `Line 4: unknown keyword '?ftypmp42'` and `Invalid data found when processing input`

C:\scripts\tools\ffmpeg\bin\ffmpeg.exe -i "concat:D:\tmp\a1.mp4|D:\tmp\a2.mp4" -c copy D:\tmp\a.mp4

merge mp4 and m4a

source: https://gist.github.com/usunyu/7d807a69508fc7aff7d8bdad71839f65

ffmpeg -i videoplayback.mp4 -i videoplayback.m4a -c:v copy -c:a copy output.mp4

extract mp3 from mp4

source: https://blog.addpipe.com/extract-mp3-from-mp4/

ffmpeg -i video.mp4 output.mp3


convert ts to mp4

source: https://superuser.com/questions/692990/use-ffmpeg-copy-codec-to-combine-ts-files-into-a-single-mp4#693009


copy /b segment1_0_av.ts+segment2_0_av.ts+segment3_0_av.ts all.ts
ffmpeg -i all.ts -acodec copy -vcodec copy all.mp4


cat segment1_0_av.ts segment2_0_av.ts segment3_0_av.ts > all.ts
ffmpeg -i all.ts -acodec copy -vcodec copy all.mp4


webm extract audio to mp3

source: https://bytefreaks.net/gnulinux/bash/ffmpeg-extract-audio-from-webm-to-mp3

ffmpeg -i webcams.webm -vn -ab 128k -ar 44100 -y webm.mp3

webm add mp3 audio

source: https://www.reddit.com/r/ffmpeg/comments/gd27u9/adding_audio_to_a_webm_file_but_retaining/

ffmpeg -i video.webm -i audio.mp3 -map 0:V:0 -map 1:a:0 -c:v copy -c:a libopus -b:a 160k -f webm output.webm

webm extract audio to opus

source: https://superuser.com/questions/1474050/extracting-opus-from-webm-losslessly-with-ffmpeg-or-mkvtoolnix

ffmpeg -i webcams.webm -vn -acodec copy webm.opus

webm add opus audio

source: https://ourcodeworld.com/articles/read/1256/how-to-add-an-audio-that-is-shorter-than-the-video-in-ffmpeg

ffmpeg -i ./video-track.webm -i ./audio-track.opus ./output-video.webm