View Full Version : MP4Box joining clips with different fps, resolution or codec
Yeast
20th March 2008, 09:07
When joining vidoes clips, it is a must to have identical fps, resolution, and codec. How can I set such parameter using MP4Box, in case when these parameters are not identical for the input files? Or should I use other tools for this purpose and then use MP4Box to join them?
Thanks,
setarip_old
20th March 2008, 09:38
Hi!should I use other tools for this purpose and then use MP4Box to join them?That's what I'd do...
bond
20th March 2008, 12:24
you can simply join two mp4 files with different fps with mp4box
i am not sure there exists anything being able to handle files using different codes and/or resolutions in one stream
Yeast
20th March 2008, 15:19
Hi!That's what I'd do...
Which tool will you use then ? I need one that support command line though
artak
28th March 2008, 11:56
If you have videos with different fps, resolution or codec, you can first encode them to the videos with the same parameters using ffmpeg open source command line application, which can set all this parameters at the encode time.
For example use -vcodec option to force video codec or -acodec for audio codec.
Use -s option for setting resolutions of video and -r option for setting the frame rate.
There is a link to ffmpeg site from where you can download it or read the documentation.
http://ffmpeg.mplayerhq.hu/
Indio
2nd April 2008, 02:04
Hi!
I didn't want to create a new topic for my question so I ask here. I'm new in using MP4Box and I'd like to know how can I change the FPS of an .mp4 file on such way, which results that my new, modified FPS file has the same length as the original.
mp4box -add a.mp4 -fps 5 -new a5fps.mp4 <- this simply doesn't work.
My files contain 2 track, a video and an audio. If I extract the video track, I can change the FPS, but if I decrease it, then the video will be much longer, while the size of the file is still the same. As a matter of fact all frame are kept, only the delay between the frames changed.
Then with -cat I can concatenate different FPS files, that's good, but I want to keep the original length.
As an alternative solution I tried ffmpeg. With this tool I could simply change the FPS with one command (I was happy, I got the result I wanted to see before, namely the FPS decreased and the length did not changed), but when I wanted to concatenate the videos (with mp4box) I only got an .mp4 file with 2 video streams. They weren't really concatenated, mp4box just threw them into the container.
So, my question is how could I create a VFR .mp4 with no length change?
Thx in advance.
Indio
4th April 2008, 16:50
Can someone help? Or is my question unclear?
bond
5th April 2008, 13:58
Indio, i assume your request makes no sense
can you tell us why you want to do what you want to do. maybe then we can find a proper solution
Indio
7th April 2008, 00:20
I guess it makes sense.
Why do I want it?
First of all I wanted to find a container format, which supports VFR, then I wanted to try to create a VFR mp4. It worked.
My question only relates to the "change fps" feature of mp4box. Originally the clip contains an audio and a video track. If I change the fps by mp4box, the length of the video track will be longer or shorter than the original video according to the decrease or increase of fps. The result is that the audio and the video will be no longer in sync.
So I'd like to change fps with mp4box, that the video length doesn't change. (As i wrote before ffmpeg can do it, but the "ffmpeg changed fps videos" can't be joined normally by mp4box.)
Drachir
7th April 2008, 10:01
MP4Box is not an encoder like FFmpeg. If you change the fps, MP4Box will only change the timescale and the sample_delta in the container. Only the time a frame is displayed change, not the count of frames. So it is not surprising that video length change.
VFR is supported by file formats based at ISO/IEC 14496-12. Each frame can be displayed a different time(sample_delta) by a given timescale(time units per second).
You can't join tracks with different timescales. This is possible the reason for your problem with FFmpeg generated files.
Some time ago someone posted a script to create VFR mp4 files - use search.
Indio
8th April 2008, 10:15
OK, thanks for the correct answer. That can be a reason.
Indio
29th April 2008, 11:24
Drachir:
You probably thought tc2mp4 script. But it creates the same output like mp4box does.
"You can't join tracks with different timescales" - do you mean with mp4box or at all? In the first case is there a way(tool) to join videos with different timescales?
Drachir
30th April 2008, 10:47
You probably thought tc2mp4 script. But it creates the same output like mp4box does.
Yes, this script I had in mind. But in files created by it, the timescale in the Media Header Box(mdhd) and the sample_delta in the TimeToSampleBox, should be adjusted according the timecode file.
You can take a look at this with "MP4Box -diso yourFile.mp4"
Maybe the author of the script can help you?
"You can't join tracks with different timescales" - do you mean with mp4box or at all? In the first case is there a way(tool) to join videos with different timescales?
I mean at all, in file formats based at the ISO base media file format, each track can have only one timescale in the Media Header Box(mdhd). You can take a look in ISO/IEC 14496-12, it is free available. If you want to join two tracks with a different timescale(if the the timescale is the only hindrance), you have to find a timescale that is a suitable for both tracks and recompute the sample_delta.
I don't really understand this although.
I have some .mp4s, which contain only video.
Here are the stats:
file1.mp4
MediaHeaderBox
TimeScale="7000"
TimeToSampleBox
SampleDelta="1000" SampleCount="655"
file2.mp4
MediaHeaderBox
TimeScale="20000"
TimeToSampleBox
SampleDelta="1000" SampleCount="655"
file3.mp4
MediaHeaderBox
TimeScale="1"
TimeToSampleBox
SampleDelta="1" SampleCount="28"
file4.mp4
MediaHeaderBox
TimeScale="5"
TimeToSampleBox
SampleDelta="1" SampleCount="132"
The timescale differs in all cases, but file1 and file2 can be joined normally, even file3 and file4 can't be.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.