[FFmpeg-user] error handling for map_channel
Elliott Balsley
elliottbalsley at gmail.com
Wed Oct 16 23:25:49 CEST 2013
I've been using ffmpeg to batch process lots of files by putting it in a find -execdir command. The source clips I'm encoding have varying numbers of audio tracks, and I always want to encode only the first two. Below is my command, which is working beautifully...
find $source_dir -maxdepth 1 -iname "*.mov" -execdir ffmpeg -i "{}" -pix_fmt yuv420p -vf scale=hd720 -acodec libfdk_aac -b:a 128k -map_channel 0.1.0 -map_channel 0.1.1 -vcodec libx264 -preset veryfast -crf 18 -level 31 H.264/"{}" \;
But when it comes to a clip that has fewer than two audio tracks, it fails with this error:
mapchan: stream #0.1 is not an audio stream.
In this case, I want the encode to have the same number of channels as the source (either 0 or 1). Is there some way to make ffmpeg handle this?
More information about the ffmpeg-user
mailing list