View Full Version : Changing the frame rate of an AVC stream.
miztadux
12th April 2007, 16:40
Is it possible to alter the frame rate of an x264 encoded video ?
I used to change the frame rate of xvid/avi using virtual dub: Video > Frame Rate > Source rate adjustment.
I'd like to do the same thing with x264/mkv using mkvmerge.
I tried the option "--default-duration XXXfps", which is mandatory with avc elementary streams, but gave it the "modified" fps value.
Everything seamed to work fine: the new fps is reported by mkvinfo, total track length as changed accordingly, audio track is synced after "seeking" in the video file...
But when actually playing the file a couple of minutes it seams to be played at the original frame rate, ignoring the new parameter in the mkv container.
So i'm wondering if there's something that needs to be done directly to the avc stream to actually change the fps, or if that's possible at all ?
nickolasemp
13th April 2007, 15:53
I would also like to know the answer to this question as well.
I also tried this but it didn't work (I did it at an audio track though, it didn;t cross my mind to do it on the h.264 track)...
I'm trying to change the FPS of a H.264 video stream inside an MKV, from 23.976 to 25... but WITHOUT have to reencoding!!!
How can I make this operation? Someone can help me please?
Yes, very simply, with a timecode file. Create a text file with this content:
Code:
# timecode format v1
Assume 25.0000
Open mkvmerge gui, drop the video in, and add the text file in the timecode slot. Remux to a new name and you're done!
nickolasemp
13th April 2007, 16:32
Finally, timecode works in h264 tracks. Though this procedure does not change the framerate of a h264 track, simply changes the way it is played back..
SeeMoreDigital
13th April 2007, 18:48
It is possible to change the frame-rate of of elementary (.h264) streams using YAMB with MP4Box.
When you first install YAMB (v1.6.0), click on the "Options" tag and in the "General Options" put a tick in the "Enable Import Settings" box.
Everytime you "Add" a stream, an "MP4Box Import Settings" window will appear, with a whole host of options, including "Force Frame Rate".
Cheers
nickolasemp
14th April 2007, 07:50
This is similar to what I am describing. It does not change the framerate natively in the stream, but it orders the container to behave according to our directions...
akupenguin
14th April 2007, 08:27
What is the definition of framerate, if not the rate at which the video is played? Sure there's also a framerate field in the SPS, but that's ignored by all players I know of, since the container timestamps take precedence. (And it has to be that way, since the SPS can't describe VFR.)
nickolasemp
14th April 2007, 08:57
All these answers are correct. it all depends on what miztadux wants to do.
Let's say for example that he just wants to play it back on his computer, then yes, all of the above are correct. But what if someday he wants to extract this stream from a (let's say) mkv container and place it to another container. Does he have to redo the forcing thing? Yes.
Instead of that, is there any other way the stream can have natively in its own data the frame rate so as to avoid this hustle?
miztadux
18th April 2007, 12:57
Thanks for your answers, i appreciate that.
For now, I don't have access to the computer where this "project" is, but I had a chance to make some quick & dirty tests this past weekend.
I tried the "mkvmerge timecodes" and "yamb import settings" methods, but they both gave me the same results that the "--default-duration" option in mkvmerge.
Again, I didn't have time to test it thoroughly (just used a lil' sample)...I don't remember exactly, but in the end the results weren't convincing (read: not as smooth as before remuxing)
BTW:
I tried to convert a 25 fps rip i made from a PAL video to 23.976, so that it would be synced with NTSC audio.
I play back the file with MPC + CoreAVC.
PS: this particular post:
http://forum.doom9.org/showthread.php?p=976971#post976971
talks about another way to build the timecodes file:
# timecode format v1
assume 29.97
0,[FRAME AMOUNT],23.976
I also tried it with similar results...
PPS: about the "timecodes" option, in the meantime I found some related threads:
http://forum.doom9.org/showthread.php?t=124187
http://forum.doom9.org/showthread.php?t=120348
With all those happy x264 framerate-changers, it seems it should work, there must be something wrong in my test setup...i'll give a shot again sometime.
Thanks again to all those who contribute to this awesome forum and provide great tools to the community ;)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.