How to demuxed audio and know what type it is?
When muxing an audio into a video, ffmpeg, mencoder, etc require to know what the audio's encoding is. The encoder typically uses the file name's extension as the "parameter". eg. .aac
However, when the audio to be muxed is being demuxed from another video, how can I determine the encoding type in a script?
The closest I've come to find this magic piece of info is to get the codec's 4CC string (four character code), but that is not suitable. *(UPDATE: It seems that this is not the 4CC code, and is actually mplayer's designation of "family of codec" .. listed via:
mplayer -afm help
/usr/share/mplayer/midentify.sh $audio |sed -nr 's/^ID_AUDIO_CODEC=(.*)/\1/p')"
My output video uses an MP4 container, so I need to know which format the input audio is, and transcode if need be... and in any case it requres the audio encoder type, not the code output by the above command.
Even demuxing seems to require foreknowledge or the codec type!
I've tried a generic dump, using
mplayer -dumpaudio $audio, but the output doesn't play even if I manually add the appropriate suffix.