muxing 2 files

Dani

Member
I have 2 webm files.
one with video and no sound.
one with sound and no video (actually the video is just blank)

they are on the WCS directory.

now I want to play them in a web-browser - I need to get the video from the first file and the audio from the 2nd file.
how do I do this ? do I need to publish 2 streams than add a mixer and publish the mixed stream as well ?

do you have a sample of similar tasks ?
 

Max

Administrator
Staff member
Good day.
now I want to play them in a web-browser - I need to get the video from the first file and the audio from the 2nd file.
The first option is to use ffmpeg to mux video from one file and audio from another, for example:
Code:
ffmpeg -i video.webm -i audio.webm -c copy -map 0:0 -map 1:1 -shortest -f webm audio_video.webm
Then, place the resulting file to webserver (nginx for example) folder to play it in browser
The second option is to use mixer as recommended in this post
 

Dani

Member
referring to the 2nd method - how do I publish 2 streams from files - once both published - I run the mixer commands in the post - then how do I publish the "mixer" stream - I don't want to record it - I just want to be able to feed it to a player like shaka-player and have the user press "play" to see it and be able to go around to specific time in that stream for example..... - the idea is to make the 2 files available in a "VOD" mode - for a single user.
 
Last edited:

Max

Administrator
Staff member
You can capture VOD from file as described here. But this is supported for MP4 container only (H264+AAC). So if you want to operate with webm recording files, not the streams, you have to use ffmpeg for muxing and nginx/apache for delivering.
 

Max

Administrator
Staff member
is it possible then to record the vp8 stream to mp4 file ?
No. VP8 requires WebM container. You should either publish H264 or transcode VP8 to H264 on server to record a stream to MP4 container.
Do you chek our recommendations about publishing H264 in this post?
 

Dani

Member
I've change the codec order and omit the stripcodec instruction and still got a very bad results.
can the mixer do the transcoding to mp4 (so I can mix 2 vp8 stream into 1 mp4) and record it ?

if not - can I use the rest api to call an extrnal script (to run the ffmpeg command?

ffmpeg does both mixing and transcoding. the only issue is the time (takes about 25% of the recording time to make the new file)
 

Max

Administrator
Staff member
I've change the codec order and omit the stripcodec instruction and still got a very bad results.
Please provide us SSH access to the server with publishing and playback ability for our engineers to check. Use this private form.
Also please check if quality issues are reproducing while publishing in Two Way Streaming or Media Devices examples.
can the mixer do the transcoding to mp4 (so I can mix 2 vp8 stream into 1 mp4) and record it ?
Yes. Please read recommendations in this post.
But, if the quality issues are caused by transcoding, they will still occur with mixer too. So, the problems should be solved before mixer testing.
 

Max

Administrator
Staff member
I read the post - my question is - the mixer output will be webm or mp4 ?
Mixer output is H.264 + Opus . Strictly this is not WebM and not mp4. So if you just play mixer output you would play H.264 + Opus WebRTC stream.
If you try to record mixer output it will be recorded to H.264 + AAC = mp4 file
 
Top