16 March, 2013

FFMpeg Piping to Mplayer

Far too often I find myself playing with ffmpeg, trying to transcode a video and evaluating the results. The typical manner of doing this is taking the input file, generating an output file, then playing with the equivalent of mplayer. The need for the temporary output file is primarily motivated because I wasn't aware how to properly pipe the transcoded video to standard output and pipe it to the display utility (e.g. mplayer). I did however recently figure this out, and decided to post for those of you struggling with the same issue. The following example takes in the popular open-source video, transcoding to mpeg format and uses only the first audio chanel, using same video quality but resizes to 720x480 and pipes the output to mplayer.

ffmpeg -i Videos/big_buck_bunny_1080p_surround.avi -f mpeg -ac 1 -sameq -s 720x480 - | mplayer -
Enjoy.

1 comment:

Anonymous said...

-ac 1 means mono (1-channel) sound, not first audio stream (-map selects streams).