View Full Version : How to demux avi with 2 video streams?
I have a H264 recorded video (http://www.sendspace.com/file/tyi3nq) which contains 2 video streams because the recorder have 2 cameras.
In MPC-HC I cannot play correctly the file, but in VLC I can watch both video streams in separate windows.
MKVMerge Gui cannot mux, VirtualDub can mux only one stream, AviDemux is crashing, Yamb is havin some error even recognized the video tracks.
I want to extract both video because I want to make a PIP video.
If this thread is not OK here I hope the moderator to move it in the right place.
Thanks!
poisondeathray
2nd April 2013, 18:12
You can use ffmpeg , using -map command for the stream
e.g
ffmpeg -i input.avi -map 0:0 -vcodec copy output0.mp4
ffmpeg -i input.avi -map 0:1 -vcodec copy output1.mp4
I used mp4 container for example, but you can use different container
Was this from a dashcam or something ?
Yes, is from a dashcam (http://forum.dashcamtalk.com/viewtopic.php?f=12&t=917).
Do you know any program with GUI regarding your solution?
filler56789
3rd April 2013, 07:35
Do you know any program with GUI regarding your solution?
Graphstudio :)
Selur
4th April 2013, 11:17
cool MediaInfo totally fails on the file,...
hotzan
2nd June 2014, 08:57
What dashcam are you using?
I've also been looking into dash cams because i always run into idiots on the road. People who drive in Vegas aren't fond of using blinkers and also some tourists tend to swerve and cut people off if they're trying not to miss an exit or are just plain lost and not attentive.
Anyone using these: http://www.szswill.com ?
jmartinr
2nd June 2014, 12:00
Do you know any program with GUI regarding your solution?
It's a bit outdated, but you could try Avi-Mux GUI (http://www.alexander-noe.com/video/amg/).
Reino
2nd June 2014, 16:09
Mtz, I don't know if this issue is still troubling you, but you don't have to extract anything. While your video on sendspace.com isn't available anymore, the video on the dashcam forum you linked to still is. I take it you have the same dashcam, so I messed around a bit...
Avisynth-script:
front=FFVideoSource("mdr_20130402_163942_I2_ORIGINAL.avi").AssumeFPS(12898,1001).Spline36Resize(1280,720)
back=FFVideoSource("mdr_20130402_163942_I2_ORIGINAL.avi",track=1).AssumeFPS(12898,1001).Crop(2,60,0,-60).Spline36Resize(352,198).FlipHorizontal()
StackHorizontal(front.Crop(0,0,-352,198),back)
StackVertical(last,front.Crop(0,198,0,0))
InterFrame(NewNum=25,NewDen=1,Cores=4)
- FFVideoSource (as well as LWLibavVideoSource) can open the secondary videostream with track=1
- AssumeFPS aligns the video- and audio duration. MediaInfo reports a framerate of 12.894fps, while FFMpeg reports 12.92fps, so as the framerate is already inconsistent, we might as well align it with the audiostream. The audiostream has 1329680samples, a frequency of 22050Hz and the videostream has 777frames; 777 / (1329680/22050) * 1001 = 12897.827.
If you're okay with the audio and video being a bit out of sync, then this step isn't really necessary though.
- FlipHorizontal ...camera footage appears to be mirrored by default, so as if you're looking through the rear-view mirror. With FlipHorizontal it's like you're actually looking behind you. Personal taste.
- StackHorizontal/Vertical ...alternative to Layer without the need to mess with colorspaces
- InterFrame ...artificially crank up the framerate to 25fps (optional)
Encode-process:
ffmpeg.exe -hide_banner -i "mdr_20130402_163942_I2_ORIGINAL.avs" -i "mdr_20130402_163942_I2_ORIGINAL.avi" -map 0 -map 1:2 ^
-c:v libx264 -preset slower -level 4.1 -bf 8 -me_range 24 -c:a libopus -ab 64k "mdr_20130402_163942_I2_ORIGINAL_FFMS2.mkv"
- open both the Avisynth-script and the AVI-file
- specify which stream to process; -map 0 (Avisynth videostream), -map 1:2 (AVI-file audiostream)
- x264 parameters
- opus parameters
End result (http://www.mediafire.com/download/5ry59mjx885732u/mdr_20130402_163942_I2_ORIGINAL_FFMS2.mkv).
SeeMoreDigital
2nd June 2014, 18:08
Hmmm...
This topic was originally posted by Mtz 14 months ago ;)
EDIT: It would also appear that Mtz has not visited this forum since the 8th December 2013 20:14...
Reino
2nd June 2014, 18:20
I know, but I didn't believe his question was answered yet.
jmartinr
2nd June 2014, 21:57
You got me. I only saw "April". :stupid:
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.