Skip to content

Instantly share code, notes, and snippets.

@cemerson
Last active July 30, 2020 21:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cemerson/18c91e8a26b0b5638338453e158026a5 to your computer and use it in GitHub Desktop.
Save cemerson/18c91e8a26b0b5638338453e158026a5 to your computer and use it in GitHub Desktop.
Helpful FFMPEG commands

Helpful FFMPEG commands

Combine Image and MP3 into a new MP4

V1:

ffmpeg -loop 1 -i image.jpg -i audio.mp3 -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest output.mp4

V2 (alt?):

ffmpeg -loop 1 -i image.png -i audio.mp3 -pix_fmt yuv420p -shortest output.mp4

Replace MP4 audio with Audio File

ffmpeg -i "myfile.mp4" -i "myfile.m4a" -c:v copy -map 0:v:0 -map 1:a:0 "myfile-audioclean.mp4"

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

Combine MP4s from list.txt into single MP4

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

(mylist.txt should have one mp4 filename per line)

Repair bad MKV file (?)

ffmpeg -i video.mkv -c copy video_fixed.mkv

(Unsure if really works) Source: https://video.stackexchange.com/questions/18220/fix-bad-files-and-streams-with-ffmpeg-so-vlc-and-other-players-would-not-crash

Other Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment