View Full Version : how can i change the framerate of my encode (losslessly)?
mob
4th October 2008, 00:38
hi everybody.
I encoded some of my PAL DVDs to x264 mkv using one of the guides. It worked well and I am pretty happy with the result, especially the quality.
But my main goal now is to make them 23.976fps in order to restore the original pitch of the audio. (Because at 25fps the audio is too high-pitched)
Is there any way to do this losslessly so I don't have to re-encode them all over again?
And if there is no way to do it losslessly, then how can I encode my PAL DVD's to to 23.976fps and not have this problem next time? (I couldn't find a guide for that)
Also, is there a way to do it without re-encoding the audio? I used the AC3 audio from the DVD and I would like to keep it that way. I just need to change the pitch and make the video go at 23.976 to keep it in sync. Hope that's not a stupid question :p
Thanks so much if you can help me with this problem. :)
Sagekilla
4th October 2008, 00:55
Easy, set the framerate as "23.976 fps" when you mux the mkv. You can use the mkv you now have as input to mkvtoolnix and just set the fps as 23.976 instead of 25. If you do this I believe the audio will be played across 23.976 frames instead of 25, thus giving the proper pitch.
If anyone knows better please correct me :)
nm
4th October 2008, 01:38
Easy, set the framerate as "23.976 fps" when you mux the mkv. You can use the mkv you now have as input to mkvtoolnix and just set the fps as 23.976 instead of 25. If you do this I believe the audio will be played across 23.976 frames instead of 25, thus giving the proper pitch.
Changing video framerate won't change audio playback speed. In this case, video is slowed down but audio is not, so sync will be lost and the pitch will stay as it was.
To change pitch while doing a PAL->NTSC conversion, the audio needs to be stretched by simply multiplying the samplerate by (24000/1001)/25 (without resampling). After this the audio can be resampled back to 48 kHz if you want to retain a standard samplerate. BeSweet should be able to do the necessary operations on the demuxed audio track (I haven't used it though, so I'm not sure).
Anyway, video doesn't need to be re-encoded, but audio does.
J_Darnley
4th October 2008, 01:54
Use mkvmerge's sync or the GUI's stretch option.
nm
4th October 2008, 02:05
That trick won't change audio pitch.
J_Darnley
4th October 2008, 02:14
That trick won't change audio pitch.
Really? I need to see why it is called stretch then.
mob
4th October 2008, 04:06
OK thanks a lot for all the helpful replies everyone.
So basically I need to do what Sagekilla said and remux the mkv and set the video to 23.976fps. Then I have to do what nm said and re-encode only the audio. I know BeSweet can do it and also BeHappy has a timestretch feature that I can use.
Now the question is, well, the audio is AC3 5.1ch. And I prefer to keep it that way if that is possible even. I know how to encode it to mp3, aac, and even ogg. But is there a way only to modify it so the pitch is corrected and make it sync with the 23.976fps video, but keep the AC3 audio?
I also tried what J_Darnley said about using the Stretch feature in mkvmerge. and you were right that it doesn't fix the audio pitch, it only keeps it in sync with the new framerate, which I can't understand how that is possible anyway... but that is clearly the way that it works somehow. Anyway, that's not good for me since I need to correct the pitch (and hopefully keep it as AC3 somehow)
nm
4th October 2008, 10:32
So basically I need to do what Sagekilla said and remux the mkv and set the video to 23.976fps. Then I have to do what nm said and re-encode only the audio. I know BeSweet can do it and also BeHappy has a timestretch feature that I can use.
Yes.
Now the question is, well, the audio is AC3 5.1ch. And I prefer to keep it that way if that is possible even. I know how to encode it to mp3, aac, and even ogg. But is there a way only to modify it so the pitch is corrected and make it sync with the 23.976fps video, but keep the AC3 audio?
Just re-encode it as AC3 after stretching. BeHappy seems to include both Aften and FFmpeg AC3 encoders.
I also tried what J_Darnley said about using the Stretch feature in mkvmerge. and you were right that it doesn't fix the audio pitch, it only keeps it in sync with the new framerate, which I can't understand how that is possible anyway... but that is clearly the way that it works somehow.
There will be gaps in audio playback when the player syncs audio and video every now and then, so stretching the timestamps won't solve anything. Try stretching by a factor of 2 and play the video without seeking. After a while there should be a gap in the sound or the audio will start to break up otherwise.
mob
5th October 2008, 06:30
Thanks a lot for helping me. I have successfully done it without any problems.
This saved me a lot of work because I thought I would have to re-encode all my DVDs again. Good thing that wasn't the case.
Now I have another question for the future. I have a couple of more PAL DVDs that I still haven't encoded yet (but plan to some day). Should I just encode them normally and then go through this process to convert them to 23.976fps?
Maybe there is a way to go directly from the PAL DVD to a 23.976fps encode? (then I could skip this whole process next time)
If anybody knows a way to do that, or has a guide for that, please let me know.
Thanks again for everyone who helped me here :)
Sagekilla
6th October 2008, 01:44
If you're talking about frame rate as a function of how many frames are displayed per second, the only thing you have to do is worry about setting fps=23.976 for your muxer and properly stretching your audio to playback @ 23.976 fps instead of 25 fps.
All this means is you're adding one extra step to do audio conversion, that's all that really needs to be done extra.
plonk420
6th October 2008, 02:49
if you extract the MP4/264 data from the MKV, will it still be the original framerate? (will it even retain the original x264 encoding settings)
Sagekilla
6th October 2008, 03:01
frame rate is only the number of frames you display per second. You can set it to anything you'd like, 1 million per second or 1 per second. The only difference is a flag saying fps = 1m or fps = 1. Frame has NOTHING to do with how you encode. It has more to do with muxing than encoding.
plonk420
6th October 2008, 03:18
surely the muxing is non-destructive to the data contained, though, right?
Sagekilla
6th October 2008, 03:36
Yes. Muxing is more or less syncing up audio + video + other data with each other. You don't really lose anything when you demux, except in certain cases where you have timing present in the stream. But for the purpose of this discussion, in transcoding a DVD to x264 + mp4/mkv, there is nothing lost.
Blue_MiSfit
6th October 2008, 19:58
I was thinking about GOP structure - say you encode with x264 with the min keyint set to 25, and the max keyint set to 250, that would produce a different GOP structure (and therefore a very different encode) than if you were to set min keyint to 30 and max keyint to 300.
Maybe not hugely different, but I wonder... :)
~MiSfit
crypto
6th October 2008, 23:55
I was thinking about GOP structure - say you encode with x264 with the min keyint set to 25, and the max keyint set to 250, that would produce a different GOP structure (and therefore a very different encode) than if you were to set min keyint to 30 and max keyint to 300.
Maybe not hugely different, but I wonder... :)
~MiSfit
Exactly and that can be a big difference between compliant or not. Another impact is on the bitrate. If a file is encoded for instance with 10 MB/s at 30fps it will result in 20 MB/s if muxed to 60fps and that's why the encoder must know the intended fps.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.