News:

--

Main Menu

MP4 Apend Question

Started by UberXYB, August 28, 2016, 10:26:40 AM

Previous topic - Next topic

UberXYB

Sorry if this is an easily fixable and or frequently asked question,
I have recorded videos utilising FRAPS on a Gameboy Emulator. There were 19 AVI files completely identical in terms of data rate, resolution etc. I individually compressed them using Handbrake as the AVI files were almost 23GB and now I have 19 MP4 files that total 184 MB. My problem comes from trying to join them; the MP4s have the same resolution, frame rate, codec and sample rate however the Video Data Rate, Total Bitrate and the Audio Bitrate are now different due to being individually compressed as I couldn't join 23GBs worth of data originally. Appending the first 16 videos works fine but the final 3 have video of essentially this: http://bordel.fisir.tk/merging.png
yet the audio remains fine at the end.

So is there any way to quickly and efficiently join the identical spec 23GB in total 19 uncompressed AVIs or make it so the MP4s are more consistent and attach perfectly to each other? What exactly causes the corrupted video at the end?

bernd_b

Quote from: UberXYB on August 28, 2016, 10:26:40 AM
... however the Video Data Rate, Total Bitrate and the Audio Bitrate are now different due to being individually compressed as I couldn't join 23GBs worth of data originally.

That's the point I don't understand - if you apply the same settings for compression to every run, I wouldn't know where differences which actually matter are comming from.

Jan Gruuthuse

Latest codecs do variable frame rates and other stuff that could vary and frame crop may also come in to play.
Try re-encoding one of the last 3 with avidemux 2.5.6 x264 (don't change settings) if the last 3 avi's play in avidemux 2.5.6.
If that works: re-encode the previous and remaining avi's with avidemux 2.5.6 x264 (don't change settings) and join the end result in avidemux 2.6.13.

eumagga0x2a

Quote from: UberXYB on August 28, 2016, 10:26:40 AM
So is there any way to quickly and efficiently join the identical spec 23GB in total 19 uncompressed AVIs or make it so the MP4s are more consistent and attach perfectly to each other?

ffmpeg -i video-01.avi -i video-02.avi -i video-03.avi -i video-04.avi -i video-05.avi -i video-06.avi -i video-07.avi -i video-08.avi -i video-09.avi -i video-10.avi -i video-11.avi -i video-12.avi -i video-13.avi -i video-14.avi -i video-15.avi -i video-16.avi -i video-17.avi -i video-18.avi -i video-19.avi -i video-20.avi -i video-21.avi -i video-22.avi -i video-23.avi -c copy joined-video.mkv

this will try to join all 23 videos in copy mode (which may fail) in a single mkv container. If the source videos do need reencoding then please refer to https://trac.ffmpeg.org/wiki/Encode/H.264

Avidemux is a great tool when you need to cut videos or to apply filters. For simple straightforward concatenation into a new container you could resort to a plain ffmpeg.

UberXYB

Thank you Bernd_b and Jan for the reply but old Avidemux wasn't happy handling several GB of video. Thank you also Eumagga0x2a I will try your method later. Joining the last 3 videos together corrupts the last two and joining just the last two in Avidemux is fine but the fps gets lowered to 29 fps meaning that retrying to join the Mp4s in Avidemux chops several seconds of the end of the video.

Any more suggestions for the Mp4s rather than the raw AVIs? Mot programs simply can't handle the 23GB and the ones that do join them at such a painfully slow unpractical rate. What exactly causes Avidemux to screw up the video on the last two MP4s?

mean

In AVi the decoding infos are repeated every keyframe, and  they can change and it is normal
For MP4 the decoding info are present only once, in the header

If you append videos which have *EXACTLY* the same decoding infos, it will work
If they differ, you'll try to decode part2 with decoding info from part1 => garbled

fish

You could try to use an intermediate lossless codec like HuffYUV, join them at that stage and then into Handbrake for final compression. Is it a continuous capture, broken into 19 files or is there a time gap between each file?

UberXYB

Thank you Mean and Fish for also replying. Yes it was a continuous capture. I found a rather unsophisticated solution of saving all the Mp4s as AVIs by using Avidemux. I then appended them that way, quality was essentially the same because saving them as AVIs made all files have the same bit rates and data rates. This probably wasn't the most practical solution but the problem has essentially been solved.

fish

That is the solution I use for tricky appends, all the files into eg HuffYUV, which allows frame accurate editing, then edit and/or join them in Avidemux and then save that file. Check it to see all is well, then compress it.

eumagga0x2a

Quote from: UberXYB on September 02, 2016, 10:41:15 AM
I found a rather unsophisticated solution of saving all the Mp4s as AVIs by using Avidemux. I then appended them that way, quality was essentially the same because saving them as AVIs made all files have the same bit rates and data rates.

Did you have to reencode anything or was it purely in copy mode? AVI is a terrible choice for modern codecs like h264 and without reencoding original codec parameters can't change. The AVI container is just able to cope with it.

If you reencoded, you inevitably lost quality.