How can I multiplex a video and audio stream?
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:
- Video Conversion done right: Codecs and Software
- FFmpeg: The ultimate Video and Audio Manipulation Tool
Related videos on Youtube
askvictor
Updated on September 18, 2022Comments
-
askvictor over 1 year
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.
-
askvictor almost 12 yearscan 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...