Correctly recode PAL 25fps dvds to standard 23.976 fps

MKV playback, recompression, remuxing, codec packs, players, howtos, etc.
Krawk
Posts: 276
Joined: Thu Jul 02, 2015 12:10 am

Correctly recode PAL 25fps dvds to standard 23.976 fps

Post by Krawk »

Many American TV shows are shot in 24fps, or more correctly 23.976, and when they're mastered for the UK, the studio will often do it the lazy way and simply speed up playback to match the 25fps data rate. Converting this back is actually not too hard with the right tools. You can choose to leave the files on your media server or hard drive at 25fps and if you've got a really good playback device it will correctly slow the frame rate down and lower the pitch of the audio as well. But what if your playback device is not so good or you just simply want to store these files back in their proper original format? Even if it seems as though you thought you changed the files to 23.976, look a little closer and tell me there aren't artifacts of some sort, such as dropped frames. You can look around on the internet for help but you will run into the same outdated, incorrect information as I did. You will find dead links, programs that do not work on anything beyond Windows XP, and so on. In my example here, I am using a Windows 10 machine, but I think the same 3 programs are available for other platforms as well. OK, so without further adieu, here we go. I will assume you are going to use the same programs I do, if not, the concept is still the same.

1) Rip your discs with MakeMKV. Most TV show dvds are 1 episode per title, and typically your rips will be the same order as the episodes are on the disc. You can verify this yourself after ripping. TIP: If you use a program such as VLC after MakeMKV has completed the rip, regardless of region code and such on the disc, it will work.
-- In this example we will say Title01.mkv is the file we wish to work with.

2) Load MKVToolnix.
a) Within the Multiplexer tool, open Title01.mkv. You are going to multiplex 2 copies of the same input file but here's what you need to do. First, in the lower pane, deselect (uncheck) all the tracks except the audio track. Click start multiplexing and very shortly you should see another file named Title01.MKA in your working directory. Next, uncheck the audio track and check (enable) the video track and anything else you want to keep. Click/highlight the actual video track in the lower pane, then on the right where it says Default Duration/FPS, select 24000/1001P. Again, click Start Multiplexing. You should see Title01 (1).mkv shortly. (I have not personally checked to see if subtitles remain in sync as I do not use them. If they do lose sync, you probably have to also do the same thing with the sub tracks as well, 24000/1001P)
b) Close your original MKV
c) Select the Info Tool within MKVToolnix. Load the newly created video Title01 (1).mkv. You're looking specifically for Duration of this track. In my example it was 00:24:03.565000000

3) Load an audio editor app. I use Audacity as it is an excellent shareware tool.
a) Select Import Audio and locate Title01.MKA (you might have to select "all files" on the file types of the load file dialog) - If the program tells you that you need to download the FFMPEG plugin, proceed to do so via the link it provides. If the program doesn't know what an MKA file is, you can rename the file to have a .ac3 extension instead, then it will prompt you to download ffmpeg plugin. The next time you use an MKA file afterwards though you do not need to rename it as the FFMPEG plugin will recognize the file type.
b) Make sure your sample rate is correct on the main screen. For dvd audio it should pretty much always be 48000hz. You can poke around other options if you wish, such as bitrates but you should not need to touch them unless you want to lower the bitrates.
-Under "Effect" select the "Change Speed" option. Because of the various obstacles, it is best to simply choose the correct duration rather than a fixed percentage. In my example here, I ensure it is 00:24:03.565 - Note that Audacity does not have the extra decimal points beyond that like you saw above in line 2c. Every time I have done this, the extra decimals have always been zeroes anyway.
c) Select ok and Audacity will process the sample.
d) Select Export audio from the File menu. It is perfectly acceptable to allow the program to use the default file extension, so save it as title01.ac3 - If you really want to use the MKA extension, save it over itself or use another name

4) Return back to MKVToolnix. Close out the info tool or just switch back to the Multiplexer. If there's something already there, close the project with the red X.
a) Now, choose New and then click add files -(still using my examples) click title01.ac3 and (hold control if you need to in order to select 2 files at once) Title01 (1).mkv
b) Click Start Multiplexing. You should see another file in a few moments, this time named Title01 (1)(1).mkv

At this point you should be able to fully manipulate Title 01 (1)(1).mkv with recoding tools like Handbrake, playback software or devices that cannot convert PAL to NTSC. Remember too that standardized video for dvd is 720 x 480 so if you recode it with Handbrake, select that resolution on the main screen and Handbrake should adjust the PAR automatically.
I also encourage you to load Title01 (1)(1).mkv and then Title01.mkv and observe the difference in audio. The final file we just created here should sound better. You don't realize there is a shift in pitch until you hear both versions. If you use a program such as MPC-HC you can select Properties while each MKV is playing back and you should see the fps has changed but everything else, including the audio should be the same.
Krawk
Posts: 276
Joined: Thu Jul 02, 2015 12:10 am

Re: Correctly recode PAL 25fps dvds to standard 23.976 fps

Post by Krawk »

I am happy to answer any questions I can, and I will edit the first post as needed.
I created the post because much of what's out there seems to be from 2008 or older. Anything newer involves commercial software, software that doesn't work as advertised or command line programs that many of us wouldn't have a clue what to enter for commands. I know my way around a CLI - my first computer was in the 80's so I am used to a DOS type environment. Not saying it'd better or less confusing though!
StoneCold
Posts: 3
Joined: Tue Oct 23, 2018 9:16 am

Re: Correctly recode PAL 25fps dvds to standard 23.976 fps

Post by StoneCold »

Thanks for writing this guide, I have exactly the same problem with PAL DVDs in Australia and you're right in pointing out that there doesn't seem to be a whole lot of info around that doesn't assume a high level of CLI understanding. What you've provided took me step by step through the process and I ended up with exactly what I was looking for - a great rip without annoyingly high voices.

FYI the Australian DVD version of The Office (US) is particularly annoying without this fix!
leethompson
Posts: 18
Joined: Wed Sep 04, 2019 12:14 am

Re: Correctly recode PAL 25fps dvds to standard 23.976 fps

Post by leethompson »

For the record, this trick does not fix subtitle streams or chapters unfortunately. (The adjust rate option is grayed out for those stream types as well.)

PAR Cheat Sheet in case you get into an argument with Handbrake:

Code: Select all

	4x3 704		4x3 720		16x9 704	16x9 720
PAL	12:11 (1.09)	16:15 (1.45)	16:11 (1.06)	64:45 (1.42)
NTSC	10:11 (0.90)	8:9 (0.89)	40:33 (1.21)	32:27 (1.19)
So if the source is a PAL 16x9 DVD converting to NTSC 16x9 you'd want to ensure the PAR is 32/27 (1.19) assuming it's full D1 source (720x576, if it's 704x576 you'd use 40/33).
leethompson
Posts: 18
Joined: Wed Sep 04, 2019 12:14 am

Re: Correctly recode PAL 25fps dvds to standard 23.976 fps

Post by leethompson »

I'd like to add some additional tricks you can do:

Subtitles:
VOBSUB (DVD) subtitles you can use the old VobSub Cutter tool to convert the subtitle framerate (with any VobSub tool be sure to always load the .idx file, not the .sub file). SubtitleCreator and Bup2Sub can help too. https://forum.videohelp.com/threads/319 ... -Framerate

Audio:
Audio of various formats can also be converted with eac3to (https://www.videohelp.com/software/eac3to):

Code: Select all

eac3to infile.mka outfile.ac3 -BITRATE -slowdown -25.000
(Where BITRATE is 384, 448, etc.)

Chapters:
Chapters can be converted with "ChapterEditor" (https://www.videohelp.com/software/chapterEditor) which has an appalling interface but you can have it load the chapters directly from the mkv and save it to your new one once you've put the video, audio, subs etc back together. (The FPS converter is the clock with a pencil in front of it icon.)
morbius
Posts: 176
Joined: Mon Aug 13, 2018 7:17 am

Re: Correctly recode PAL 25fps dvds to standard 23.976 fps

Post by morbius »

I just came across this thread and want to thank the OP for posting a very helpful guide. A couple of small remarks:

it seems to me that it's better to export the re-pitched audio from Audacity to PCM. If we start with a lossy source like Dolby Digital, exporting to DD will require a re-compression that will degrade quality?

For other noobies to Audacity, by default it will only output stereo PCM. However if you go into user preferences, you can permit an export of multi-channel PCM by going to Import/Export preferences and selecting the "Use advanced mixing options" option.
bigjoe
Posts: 3
Joined: Thu May 21, 2020 3:08 am

Re: Correctly recode PAL 25fps dvds to standard 23.976 fps

Post by bigjoe »

Wow thank you so much for making this guide. After googling for a while, with all results being completely useless by people who don't know anything, I was beginning to give up hope until I stumbled upon this. Now with your simple and easy to understand guide, I was finally able to do this with ease. Why the internet has barely any useful information on this is beyond me. You sir, are a legend.

I do have a concern though. While I believe changing the video to 23.976 fps in MKVtoolnix is lossless (it is right?), I can't be so sure that changing the speed of the audio and re exporting it in Audacity is. What should we be exporting it as to make sure the audio is lossless? Or is that not possible? Which option would at least give us the best possible quality?
Last edited by bigjoe on Sun May 24, 2020 3:02 am, edited 1 time in total.
bigjoe
Posts: 3
Joined: Thu May 21, 2020 3:08 am

Re: Correctly recode PAL 25fps dvds to standard 23.976 fps

Post by bigjoe »

Just one thing I'd like to add. If like me, in step 3a your Audacity did not offer you a link to get the ffmpeg plugin, there are instructions on how to install them manually here: https://manual.audacityteam.org/man/ins ... ndows.html
morbius
Posts: 176
Joined: Mon Aug 13, 2018 7:17 am

Re: Correctly recode PAL 25fps dvds to standard 23.976 fps

Post by morbius »

I’ve had great success using this method with many R2 DVD titles. I have been exporting the audio to FLAC to avoid further transcoding. I had to tinker with the options in Audacity to allow that option.

The final mkv in effect contains a “48i” video stream. I was delighted to find that my Kodi Pi’s can handle this in hardware playback. I use OMX player, which allows deinterlacing to be force disabled, which I have found is sometimes necessary to avoid choppy playback.
bigjoe
Posts: 3
Joined: Thu May 21, 2020 3:08 am

Re: Correctly recode PAL 25fps dvds to standard 23.976 fps

Post by bigjoe »

morbius wrote:
Sat May 23, 2020 4:43 pm
I have been exporting the audio to FLAC to avoid further transcoding. I had to tinker with the options in Audacity to allow that option.
Where are these options? Is the 32-bit float WAV not lossless also though?
morbius
Posts: 176
Joined: Mon Aug 13, 2018 7:17 am

Re: Correctly recode PAL 25fps dvds to standard 23.976 fps

Post by morbius »

When I first installed Audacity I could only output to stereo. Go to Edit \ Preferences \ Import/Export, and change to "Use Advanced Mixing Options".

Early on when experimenting with this I had a re-timed 5.1 DTS track that broke the 4GB limit for WAV files. FLAC is unlimited, and of course smaller, hence I use FLAC for everything.

Also, a correction to my earlier post, it's MMAL playback on the Pi that enables user selection of the hardware-accelerated deinterlacing options.
morbius
Posts: 176
Joined: Mon Aug 13, 2018 7:17 am

Re: Correctly recode PAL 25fps dvds to standard 23.976 fps

Post by morbius »

I've now re-encoded quite a lot of 25fps dvds in this way, and most of them have worked fine. I have a couple where the lip-sync goes completely wrong, both in VLC player and in Kodi. Anyone have any ideas on what might have caused this, or how to fix?

Also, I noticed that when I updated Audacity from v2.3.3 to 2.4.1, the FLAC export time became incredibly slow, and when I reinstalled 2.3.3. this went back to a sensible speed, so it looks like there is a regression in 2.4.1.
morbius
Posts: 176
Joined: Mon Aug 13, 2018 7:17 am

Re: Correctly recode PAL 25fps dvds to standard 23.976 fps

Post by morbius »

I just noticed for a title where the lip-sync failed that the extracted source audio .mka file has a duration that is almost a second shorter than the reported duration of the source mkv file. So this would explain why the lip-sync goes wrong with downstream processing. Does this give a clue as to how the re-encode might be fixed?
morbius
Posts: 176
Joined: Mon Aug 13, 2018 7:17 am

Re: Correctly recode PAL 25fps dvds to standard 23.976 fps

Post by morbius »

ok, one more post on this, in case it helps others. As noted above, I found a couple of titles where the re-encode is unwatchable due to poor lip-sync.

I fixed this by using the FLAC profile in MakeMKV, it turned out on one title there was a 480ms delay on the DTS soundtrack that needed to be filled with silence, doing that at source during the ripping stage then gave an accurate duration for the audio prior to being stretched in Audacity.

Note, in MakeMKV 1.15.1, the FLAC profile has no entry for DTS 5.1 source files (it does have DTSHD). I had to create my own version and add DTS. Not had the chance yet to see if any other common source types are missing from the FLAC profile.
Grauhaar
Posts: 566
Joined: Thu Sep 15, 2016 3:46 pm

Re: Correctly recode PAL 25fps dvds to standard 23.976 fps

Post by Grauhaar »

You can simply change the audio delay up or down with "MKVToolNIX Gui" by selecting the audio track and specify the value in the "Delay (in ms)" field and remux the file. If you are unsure what is the correct value, view the movie in VLC and use the "Tools -> Track Sync" option to adjust the value.
Good Luck :)
_____________________________________________________________
Useful MakeMKV links: FAQs - Debug Log - Buy - Expiration of beta key
Two Blu-ray (UHD) Drives LG LG BH16NS55 with Libredrive Firmware 1.04
Post Reply