UP | HOME
grm blog. Work is copyrighted unless otherwise stated.
2023-01-03 Tue
^

ffmpeg stuff

Some useful ffmpeg commands.

video from pngs

ffmpeg -framerate 24 -r 24 -i %04d.png -c:v libx264 -pix_fmt yuv420p out.mp4

Merge video and audio

use the -shortest option in order for the output video to calculate the total duration based on the shortest of the two.

with reencoding

ffmpeg -i in_video.mp4 -i in_soud.ogg -c:v copy -c:a aac out.mp4

without reencoding

Use mkv container

ffmpeg -i in_video.mp4 -i in_soud.ogg -c copy out.mkv

Merge two mono wav sound files to a single stereo mp3 one

ffmpeg -i a.wav -i b.wav -filter_complex "[0:a][1:a]join=inputs=2:channel_layout=stereo[a]" -map "[a]" -vn -ar 44100 -ac 2 -b:a 192k output.mp3
  • vn disables video
  • ar sets the sampling rate
  • ac sets the number of channels
  • b:a 192k - Converts the audio bit-rate to be exact 192 KB/s