Skip to content

Instantly share code, notes, and snippets.

@maxgfr
Last active February 14, 2023 12:51
Show Gist options
  • Save maxgfr/85e4a6ea46f0f8c5cb539a92267766b2 to your computer and use it in GitHub Desktop.
Save maxgfr/85e4a6ea46f0f8c5cb539a92267766b2 to your computer and use it in GitHub Desktop.
Tricks using ffmpeg

FFMPEG

How to generate an empty video of 12 minutes ?

$ ffmpeg -t 720 -s 640x480 -f rawvideo -pix_fmt rgb24 -r 25 -i /dev/zero empty.mpeg

Concat videos using ffmepg

Source : https://stackoverflow.com/questions/7333232/how-to-concatenate-two-mp4-files-using-ffmpeg

$ cat mylist.txt
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
$ ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4

Convert mkv files to mp4

$ for f in *.mkv;do ffmpeg -i "$f" -c:v copy -c:a aac -b:a 256k -strict -2 "${f%mkv}mp4";done

Convert m4a to mp3

for i in *.m4a; do ffmpeg -i "$i" -acodec libmp3lame -aq 2 "${i%.m4a}.mp3"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment