Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > New and alternative a/v containers

Reply
 
Thread Tools Search this Thread Display Modes
Old 22nd June 2013, 00:34   #1  |  Link
digitall.h
Registered User
 
Join Date: May 2012
Location: Here
Posts: 257
Concatenate several mp4 files

I have encoded 12 chapters from 3 DVDs.
Each chapter was encoded using latest Hybrid Linux version 2013.06.16.1, in mp4 containers, and all of them are in the same format: an x264 video track, original ac3 audio track and chapter track.They share the same video PAR and same audio bitrate and channels.
I now want to join them in a single file.
I tried with MP4Box:
Code:
MP4Box -add 01.mp4 -cat 02.mp4 -cat 03.mp4 -new all.mp4
It merged the videos, but first chapter did not have audio track.


I then tried:
Code:
MP4Box -cat 01.mp4 -cat 02.mp4 -cat 03.mp4 -new all.mp4
And it generates a single mp4 file with all chapters, but the generated file has 2 problems:
  • Audio goes out of synch
  • When playing the file, there appears video artefacts that are not present in the files generated by Hybrid
The audio problem I googled a bit and found that it's a known problem. I don't know if I can fix it with some tweak in the MP4Box command.
The video problem is a weird one, since I thought that MP4Box just concatenated the files, and I don't understand why it degrades the encode.

Can I change anything in my code to avoid these problems?.
Is there another method to join the mp4 files?.
My system is Linux Mint KDE 13.
digitall.h is offline   Reply With Quote
Old 10th July 2013, 19:15   #2  |  Link
digitall.h
Registered User
 
Join Date: May 2012
Location: Here
Posts: 257
I'm sorry for reposting in the thread I initiated.

I don't know if either this question is not interesting for most of the forum,
or if it was not explained properly and that made it difficult to answer.

Or just it's a problem difficult to be solved/answered.

Please let me know if a can give further details to better explain my question.

Thanks
digitall.h is offline   Reply With Quote
Old 10th July 2013, 20:52   #3  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 6,443
Latest x264 has an option 'stitchable' which might help with the visual artifacts problem. (helped me with MKV Cutter, with some clips)

About the audio problem, this might be due to different start delays (Hybrid has an option 'fix delay' with delaycut, which might help assuming you reencode the audio).
Other than that I would try to: use mmg to append the files and multiplex to mkv, then remux to mp4 using ffmpeg and then remux the mp4 with mp4box.
__________________
Hybrid here in the forum, homepage
Notice: Since email notifications do not work here any more, it might take me quite some time to notice a reply to a thread,..
Selur is offline   Reply With Quote
Old 10th July 2013, 23:17   #4  |  Link
digitall.h
Registered User
 
Join Date: May 2012
Location: Here
Posts: 257
Thank you selur for your answer.

I activated the 'fix delay' option in Hybrid. In fact, individual mp4 files are in synch, and they get out of synch when joined with MP4Box.

My x264 version is r2171, and does not have --stitchable as argument

I may try the mkv way. I did not understand the convert mkv to mp4 with ffmpeg step, and why then convert that mp4 again to mp4 with MP4Box.
Do you think it could be possible to demux the individual mp4 to the elementary x264 and ac3 streams, then add them and join them in a mkv, and again demux the mkv to a joined x264 and a joined ac3, and mux them again with MP4Box?. I may always try.


I'm back
I tried to join directly mp4, and also tried to join the elementary streams, and mmg complains that the video track parameters do not match.
Could this be done in Hybrid?. I mean, can I provide a kind of playlist, as in blu-ray, that points to every chapter movie in the DVD?. This functionality would not be of common use, just in anime and TV series, where a DVD contains several chapters.

Last edited by digitall.h; 10th July 2013 at 23:50. Reason: New info
digitall.h is offline   Reply With Quote
Old 11th July 2013, 12:06   #5  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 6,443
Quote:
I did not understand the convert mkv to mp4 with ffmpeg step,
What's unclear about it?

Quote:
why then convert that mp4 again to mp4 with MP4Box.
because ffmpeg tends to sometimes mess up with the mp4 container headers depending on the version used, so I always remux with mp4box if I use ffmpeg for muxing.

Quote:
mmg complains that the video track parameters do not match.
That's where "--stitchable" is ment to help.

Quote:
Could this be done in Hybrid?. I mean, can I provide a kind of playlist, as in blu-ray, that points to every chapter movie in the DVD?.
Hybrid does support the encoding of chapters on their own and it does support the encoding of each title of a DVD separately.
So if you have a DVD of a TV series Hybrid can encode each title of the series to a different file.
Hybrid is not able to merge the all the titles into one file; unless there is a separate title which does this already.
So: No, Hybrid does not merge different inputs/titles, mainly because bears a lot of potential problems (handling of non-compatible headers, handling of subtitles, attachments, timecodes,..) which are not always easy to deal with.

Quote:
In fact, individual mp4 files are in synch,...
They were before too, right? (only difference should be that the a/v delay should now be zero.
Quote:
.. and they get out of synch when joined with MP4Box.
does MP4Box output any warnings or similar?

Cu Selur
__________________
Hybrid here in the forum, homepage
Notice: Since email notifications do not work here any more, it might take me quite some time to notice a reply to a thread,..
Selur is offline   Reply With Quote
Old 11th July 2013, 23:05   #6  |  Link
digitall.h
Registered User
 
Join Date: May 2012
Location: Here
Posts: 257
Quote:
Originally Posted by Selur View Post
What's unclear about it?
Quote:
because ffmpeg tends to sometimes mess up with the mp4 container headers depending on the version used, so I always remux with mp4box if I use ffmpeg for muxing.
Now it's clear.

Quote:
That's where "--stitchable" is ment to help.
I will try to find a ppa to install the latest x264. I prefer to install through package manager, so it keeps the package updated. If this stitchable switch is working well, it would be of a help.
I will have to investigate a bit to understand how x264 makes compatible different and independent encodings.
Anyway, stitchable will help with artefacts, but not with audio loss of synch.

Quote:
does MP4Box output any warnings or similar?
Mp4Box does not complain neither when muxing the individual mp4 nor when joining them...


I'm afraid I'm a little stuck
In windows I would use MeGUI. In Linux some day I will eventually be able to create a script with avXsynth or VapourSynth and feed Hybrid with it. But I don't see an easy solution now.
digitall.h is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:07.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.