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
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 3rd December 2015, 15:40   #1  |  Link
alexVS
Registered User
 
Join Date: Sep 2004
Posts: 147
Help me to join two mp4 files into one with mp4box, plz

I've got 2 files from the same hockey game from youtube. And I want to join them. Originally the game was divided into 4 big parts (30 min each), and I guess they were encoded with a slightly different parameters.

But they look VERY similar.

https://drive.google.com/folderview?...U0&usp=sharing

files: 02.mp4 and 03.mp4

I tried yamb, no success (audio joined, video - only first file)
I tried use command line
"d:\yamb\mp4box.exe" -force-cat -add "d:\02.mp4#1:fps=29.970" -cat "d:\02.mp4#2:lang=en" -cat "d:\03.mp4#1:fps=29.970" -cat "d:\03.mp4#2:lang=en" -new "d:\new2.mp4"
Second part full of green arfifacts.

Help, please!

I uploaded short samples to google drive

Last edited by alexVS; 3rd December 2015 at 15:44.
alexVS is offline   Reply With Quote
Old 3rd December 2015, 17:40   #2  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
One of the files uses weighted prediction and the other one does not. Such a change of encoding parameters is not allowed to happen in mp4 or mkv containers and that's why the video can get messed up if you try to append them losslessly using mp4box.

Possible solutions:
- re-encode one of them to match the encoding parameters of the other one (or if you don't know how to do that:)
- splice them in e.g. AviSynth and re-encode the complete file
- try downloading a different version from YouTube and see if it can be appended (WebM/VP9 in mkvtoolnix?)

(May work for some players but not really recommended:
- make sure all h.264 headers are repeated throughout the stream and then append losslessly.)
sneaker_ger is offline   Reply With Quote
Old 3rd December 2015, 18:33   #3  |  Link
Soulvomit
Registered User
 
Join Date: May 2012
Posts: 28
I was able to losslessly join your samples with none of the playback artifacts, at least not with the latest VLC or QuickTime, but it wasn't easy. But before getting into that, can you post the YouTube links to all the parts? I would like to know whether or not the sources behave the same.

http://sendspace.com/file/ufuomw
Soulvomit is offline   Reply With Quote
Old 4th December 2015, 16:16   #4  |  Link
alexVS
Registered User
 
Join Date: Sep 2004
Posts: 147
Four parts of the game on youtube
https://www.youtube.com/watch?v=z0xDQ8apgVA
https://www.youtube.com/watch?v=PJknSsVdEm8
https://www.youtube.com/watch?v=e59mefFUl0I
https://www.youtube.com/watch?v=l-qZ846aOvU
Downloaded with YouTubeDownloaderHD (portable in ZIP) ver. 2.9.9.25 (saved as 480p)
02.mp4 is extraction from first, 03.mp4 is from second.

BTW I managed to join them. 02, 03 and other extractions with the help of batch file I found in the net. Just changed paths, names and it worked.
Code:
ffmpeg -y -i "01.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts "source01.ts"
ffmpeg -y -i "02.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts "source02.ts"
ffmpeg -y -i "03.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts "source03.ts"
ffmpeg -y -i "04.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts "source04.ts"
ffmpeg -y -i "05.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts "source05.ts"

ffmpeg -y -i concat:"source01.ts|source02.ts|source03.ts|source04.ts|source05.ts" -absf aac_adtstoasc -c copy -f mov "destination.mp4"
pause
I haven't any idea what ffmpeg does here, and what these parameters means, but looks like it works without reencoding the source.
alexVS is offline   Reply With Quote
Old 5th December 2015, 09:48   #5  |  Link
foxyshadis
Angel of Night
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
The beauty of TS is that you don't need to care how segments were encoded, it doesn't strive for efficiency and just repeats each one's information constantly. MP4 is much stricter, a little unfortunate but it's a bit late to change that. MKV might be able to do it but would need some tweaking. Your solution is probably the simplest solution to keeping them in a single file without re-encoding.
foxyshadis is offline   Reply With Quote
Reply

Tags
mp4box join mp4 help


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 15:50.


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