Close

command line ffmpeg/mplayer wrapper program

A project log for Silly software wishlist

Motivation to do some software projects by writing them down.

lion mclionheadlion mclionhead 07/03/2020 at 20:480 Comments

Lions originally wanted everything to have a GUI.  In old age, lions just want as much computing power devoted to the task as possible instead of the interface.  After writing a video editor, lions have accumulated many usages of ffmpeg & mplayer  from the command line.  The mane use of mplayer is extracting decompressed audio.

mplayer -ao pcm:file=audio.wav -vc null -vo null 

But specifying the output file doesn't work.  ffmpeg has a usage which extracts decompressed audio, but this works for fewer sources.

ffmpeg -i <input file> -vn <output file.wav>

Then there's extracting the audio from a movie without any transcoding.

ffmpeg -i <input file> -vn -acodec copy <output file>.mp4

Extract the video from a movie without any transcoding:

ffmpeg -i <input file> -an -vcodec copy <output file>.mp4

The other thing lions use ffmpeg for is transcoding video from a variable framerate to a fixed framerate file.  This degrades the quality, but if the specified bitrate is higher than the input bitrate, it'll encode as high as the input bitrate.

ffmpeg -i <input file> -c:v mpeg4 -vb 5000k -an <output file>

Lions use ffmpeg to encode from an uncompressed source, for debugging machine vision programs.  This isn't as fast as linking ffmpeg & calling the functions with a memory resident frame buffer but it's simple.

ffmpeg -y -f rawvideo -y -pix_fmt bgr24 -r 15 -s:v <width>x<height> -i - -c:v mpeg4 -vb 5000k -an <output file>

It would be a lot simpler if these most common ffmpeg usages were condensed into yet another wrapper program.

Discussions