View Full Version : Creating one output video with two videos in avisynth?
mizumi
26th June 2011, 17:57
I want to join two different mp4 videos. I have tried avidemux, yamb and mp4box with no luck. I could join the videos using avidemux but in some parts the output video became jerky.
So I wonder if I can create a single mp4 out of two different vobs using avisynth. I thought of creating an AVS script that calls both videos (and the filters I want to use for each of them) and creates a single output video.
Does somebody know how to do such script?
pbristow
26th June 2011, 22:23
Well, it all depends what the problem is with joining them together in those other tools you've already tried.
For example, if the attributes of the two MP4 files all match up (i.e. size, frame rate, etc.), then this AviSYnth script will do it:
clip1 = DirectShowSource("whatever.mp4")
clip2 = DirectShowSource("somethingelse.mp4")
clip1 ++ clip2
But then, to use the AviSynth script, you'll need to call it from some editor program such as VirtualDub - And since VirtualDub can do joining together of (matching) videos all on its own, why bother using AviSynth?
However, if the problem is that your two videos *don't* match, then AviSynth gives you a very useful set of tools (resizers, frame rate changers, deinterlacers, etc.) to help them fit together.
Hope this helps.
mizumi
27th June 2011, 09:17
Thank you for your answer :)
The thing is I encode using ABR mode in the configuration for x264. I used the same bitrate for both videos, same resizing values, etc. Then all programs I tried for joining both videos complained about the two videos not having the same bitrate.
So I tried using avisynth with the script you gave me but MeGUI complained about the same thing.
Then I thought about using CBR mode but I realised there's none for x264, is there? So I tried "constant quality" mode using the same quality for both videos. I tried joining them with MP4box and even though it complained about them not having the same bitrate it joined them. It turned into a video which was two times the length of the original one and it was not playable :eek: Then I tried joining them using avidemux and it complained about the video having or not having? B frames but I finally managed to join them.
MP4 is such a pain in the ass. It gives great quality compared to xvid but oh, I really miss using virtualdub. It was faster and you could edit everything in it, something I can't do with MeGUI T_T
Anyway back to MP4... is there anyway to get a constant bitrate so that I can join both videos?
Gavino
27th June 2011, 09:52
... all programs I tried for joining both videos complained about the two videos not having the same bitrate.
So I tried using avisynth with the script you gave me but MeGUI complained about the same thing.
What error message did you get?
When using Avisynth, all source videos are decompressed, so the original bitrates are irrelevant. It's likely the problem is that some other property of the videos is different, eg frame rate, audio characteristics, etc. Use MediaInfo to see what are the properties of each video.
As pbristow says, you can use Avisynth functions in your script to make them compatible before joining.
mizumi
27th June 2011, 10:47
Oh, true, I just realized the message I got about the video was "different frame rate". I just kept confusing frame rate for bitrate lol I forgot to put the same fps to the two videos so I'll try to reconfigure them and see if everything works.
Malaksbane
27th June 2011, 13:24
Sometimes Avisynth will report framerate mismatches even when it 'should not', it may be enough to just use AssumeFPS().
... And since VirtualDub can do joining together of (matching) videos all on its own ...
It does? How? I missed that feature.
pbristow
27th June 2011, 13:55
It does? How? I missed that feature.
Load the first section in the normal way, then select "File", "Append AVI segment" for any subsequent parts.
That said, it may only work with AVI files... Dunno, I haven't tried it. (I do all my editing work in AVI. MP4 format is really intended for storing video in the smallest possible space for replay, not for editing - as you're finding out.)
Malaksbane
14th August 2011, 19:26
Sorry for responding so late.
Append Avi segment is intended for, and probably only works with avi's that virtualdub splits (because of filesize limits). It does not work with regular avi's
pbristow
14th August 2011, 21:16
Sorry for responding so late.
Append Avi segment is intended for, and probably only works with avi's that virtualdub splits (because of filesize limits). It does not work with regular avi's
Oh yes it does. :) I use "append avi segment" quite frequently with "regular AVIs". There are *some* cases that it has trouble with: usually files where the audio track is not the exact same length as the video, or where the audio was encoded with variable bitrate. In such cases, I just transcode all the segments first to copies with uncompressed audio (using "direct stream copy" for the video, so that the quality doesn't degrade at all). You can then join together the cleaned-up copies of the segments.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.