I have a seperate video and audio stream (coming from IPWebcam on an android device), and would like to multiplex (and perhaps transcode) them into a single video file, using a linux server. How can I achieve this? I've tried all manner of things with VLC, but to no avail yet.


If you have FFmpeg (which can and should be compiled from source):

ffmpeg -i video.avi -i audio.wav -map 0:0 -map 1:0 -c:v copy -c:a copy output.avi

This will copy the raw bitstreams of video and audio from video.avi and audio.wav to output.avi.

If you want to transcode video and audio, just pass proper c:v and c:a parameters, e.g. for something more state of the art:

ffmpeg -i video.avi -i audio.wav -map 0:0 -map 1:0 -c:v libx264 -crf 21 -c:a libfaac output.mp4

Here, crf controls the video quality with sane values from 19 (better) to 24 (worse). AAC audio is used instead.

Read up on video conversion (with standard tools or using FFmpeg) on our blog:

  • can ffmpeg pull in http streams? The two streams are coming over the network; I'd like to merge them into a file or another stream. I guess I could always muck around with pipes... – askvictor May 28 '12 at 11:09
  • FFmpeg can probably do it with FIFOs, but no guarantees since I've never tried it.. see here: stackoverflow.com/questions/1360797/… – slhck May 28 '12 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.