I am trying to find information about how to transcode a file into multiple outputs in one shot, but I don't seem to be able to. Most of the results I find describe the opposite: merging multiple files into one.
Here's the situation:
I have an IP webcam that takes a "dump" or raw capture (although I don't like to say 'raw' because it may be mistaken with the .raw format) that consists of two streams: An H264 video and a PCM audio.
I need to transcode that "raw/dump" capture into three MP4 files, two of them with audio and video (H264+AAC) and the third one with just the AAC audio; more specifically:
A file at the same resolution than the original, ensuring it runs at 30 fps, has aac audio at 128kbps and the pixel format is yuv420p (the "dumped" video stream's pixel fomat is yuvj420p, which makes the stream in unplayable directly in Chrome... at least for now).
A file with the same features as above, but half the resolution.
- A file containing just the AAC audio.
I have the command to get the first file working pretty well (although I someone has any comment for that one, it will be greately appreciated as well):
/usr/bin/avconv "/home/borrajax/Videos/original.dump" \ -acodec libvo_aacenc -ac 1 -ab 128k -ar 44100 \ -vcodec libx264 -preset fast -r 30 -pix_fmt yuv420p \ "/home/borrajax/Videos/transcoded.mp4"
Probably I could save some of the options, but the issue is that the camera's configuration can be modified, so I need to make sure that the resulting .mp4 has the format I need (that's why I specified so many)
My guess is that is probably good idea (I say "probably" because I don't know
much anything about video encoding) trying to transcode the three files in one shot, re-using the transcoded data to save time.
For instance: the video with half the resolution of the original one will have exactly the same audio than the "big" one so there's no need to transcode it again. Obviously, same thing goes for the audio file. There shouldn't be a need to transcode three times. Also, maybe (and here, I don't know what will be better) I can also reuse the video stream. Since I need two videos with a different fps and pixel format than the original maybe it's worthy transcoding only once (like I'm already doing in the command above) and then grab that video stream that already has 30fps and yuv420p pixel format and just make its resolution half.
I guess it'll be a good idea to sum up... how can I chain (pipe?) multiple outputs with avconv, applying different options to each?
- Ubuntu 12.04 LTS
- avconv version 0.8.5-4:0.8.5-0ubuntu0.12.04.1
Thank you in advance!