VideoHelp Forum




+ Reply to Thread
Results 1 to 24 of 24
  1. I have some questions, I've been reading a lot the past few days and trying different approaches. A lot of the threads I have found are very old, the same goes for the recommended programs.

    DVDs transferred with MakeMkv.

    The easiest way I've found is the following: MKVToolNix, video - FPS: 24000/1001p, audio and subtitles - stretch by 25025/24000. Is there any reason for not doing it this way? My understanding is that the audio doesn't need any other processing to correct the tone-difference other than the speed adjustment?

    Alternative way, extract the audio, open in Audacity, set duration that corresponds to the new video file (24000/1001p) store new file as Flac (or other, haven't been able to keep the MKA-extension). Extract subtitles to sub/idx and change the frame rate with VobSub Cutter. Finally mux together with MKVToolNix.

    I have done tests with both approaches and both seem to work fine.
    Last edited by Flintheart; 22nd Apr 2020 at 17:37.
    Quote Quote  
  2. I think the main disadvantage of stretching the audio that way (MKVToolNixGUI) is it can cause pops and crackles on playback. It depends on the codec. I'm also not sure if it changes the pitch. If a DVD started off as film (23.976), when it's sped up for PAL the audio is rarely pitch corrected (the pitch increases slightly), so slowing it down without pitch correction would be the right thing to do. Music DVDs such as concerts are often an exception.
    If it's a PAL source (shot at 25fps) then you'd want to pitch correct if you slow it down.

    Setting a duration in audacity would only work if the audio and video are exactly the same length. That's often not the case, and you should check to make sure there's no audio delay set in the MKV container. If the audio is delayed, that can also throw a spanner in the works. If Audacity has an option to stretch by a percentage, it'd be better to do it that way.

    If you're not an Avisynth user, you can do it with an Avisynth based GUI such as MeGUI (I'd recommend the 32 bit version). If you extract the audio with gMKVExtractGUI it'll write any delay to the file name. ie
    Episode 1_DELAY 50ms.ac3
    When you load the extracted audio into MeGUI's audio section it'll pick up the delay and add silence when encoding. The output file's name will be changed to a delay of zero. From the "Encoder Settings" drop down box in the audio section, pick the type of audio you want for the output, then click "Config" next to the drop down box. Set your preferred encoder settings, and under "Time Modification" select one of the 25 to 23.976 slowdown options.
    Click okay to close the encoder configuration, then click Queue near the bottom right corner. Switch to the Queue tab and run the audio encoding job.

    If you want AAC/m4a as the output there's 4 options. I'm pretty sure ffmpeg AAC is the only one enabled by default, but it's the lowest quality. The others require the downloading of files yourself, and you need to enable them under Options/External Programs before they'll appear as audio encoder choices. If you enable NeroAAC you need to download neroAacEnc.exe and put it in the "MeGUI\tools\eac3to" folder. It's the second best quality. The best quality AAC encoder is QAAC. If you want to enable it you'll need to put the folder in this zip file in the "MeGUI\tools\qaac" folder. All the encoders have the same speedup/slowdown options because that's done with Avisynth. You won't hear a difference between NeroAAC and QAAC at decent bitrates.

    MeGUI may go nuts wanting to update stuff when you first run it. Just let it update whatever it needs to. There's no doubt other programs that'll do the same PAL speedup/slowdown, but MeGUI is the one I'm most familiar with. If you know how to use Avisynth, the AudioSpeed script in my signature can do PAL speedup/slowdown easily enough.

    PS Is the audio in your MKVs AAC? DVDs don't support AAC audio so I assume it was originally DTS or AC3 etc and converted to AAC by MakeMKV. If that's correct you may be better off ripping the DVDs with the original audio and converting that instead, rather than converting the converted audio a second time.
    Last edited by hello_hello; 22nd Apr 2020 at 17:40.
    Quote Quote  
  3. Thank you for a great answer!

    Correct me if I'm wrong, but if the film was shot at 25 fps there is no reason to do anything with it?

    I did as you suggested, tried out MeGUI and all is well, the audio from MakeMKV is AC3 for the most part (I have also seen DTS), I also used AC3 in MeGUI. The file size came out almost identical, FLAC increased the file size seven times!

    A positive thing that MeGUI isn't 10 years old and discontinued.

    I guess I'm a bit late to the party regarding this problem, but I find it interesting reading and learning "new" technical stuff like this. And if someone in the future is searching for a solution this thread could be helpful.
    Quote Quote  
  4. Originally Posted by Flintheart View Post
    Thank you for a great answer!

    Correct me if I'm wrong, but if the film was shot at 25 fps there is no reason to do anything with it?
    Only if you have a player that won't play it, but that wouldn't apply to players that'll play MKVs. Only when playing DVD and Bluray discs. Assuming you live in NTSC-Land. PAL DVD and Bluray players usually play anything.

    Originally Posted by Flintheart View Post
    I did as you suggested, tried out MeGUI and all is well, the audio from MakeMKV is AC3 for the most part (I have also seen DTS), I also used AC3 in MeGUI. The file size came out almost identical, FLAC increased the file size seven times!
    That was quick. I'm glad it's working for you. FLAC is lossless, so it'll generally result in larger file sizes for lossy, compressed sources. For DTS, which is generally high bitrate, it might reduce the file size a bit.
    AAC should give you better quality at a lower bitrate than AC3, although if you use a high enough bitrate for AC3 it should be fine. I use the default settings for both NeroAAC and QAAC. The defaults use variable bitrate encoding, and for 5.1ch audio that'd usually result in a bitrate of somewhere around 400kbps for 5.1ch audio (it'll vary from source to source). For AC3 I'd use at least 448kbps for 5.1ch, or even 640kbps. AAC is probably a little more compatible with standalone players, although if you send the audio to a receiver for it to do the decoding, it'd be more likely to support AC3 decoding.

    Originally Posted by Flintheart View Post
    A positive thing that MeGUI isn't 10 years old and discontinued.
    Actually, it's about 15 years old and unfortunately there's only one person doing the majority of the work maintaining and developing it, and he doesn't seem to have had much time to spend on it lately, but it works, and the 3rd party tools it uses are still updated. It started out as a GUI for MEncoder (hence the Me part of it's name) so it's seen a few changes. I wasn't using it myself back then. I think I discovered it about 8 years ago.
    Last edited by hello_hello; 22nd Apr 2020 at 17:22.
    Quote Quote  
  5. I live in PAL-land.

    Just to clarify, what I meant to say was that it's positive that it's not 10 years since it was updated. That was one of the biggest problems researching this, which programs to use, so many out of date, which are still good?

    Avisynth, then the fork Avisynth+, I found VirtualDubMod recommended for scripts, last version 2007. AvsPmod looks like a better choice, but is it the right choice?
    Quote Quote  
  6. I mostly use MeGUI. When you use the File/Open menu to open a source, it'll open it's File Indexer and offer to index it. It generally defaults to the best indexing method for the source, so you'd add the indexing job to the job queue and run it. It'll extract the audio if you want it to. If it can't (depends on the format) it'll create a script to re-encode it. When it's done, the Script Creator opens with a preview. Under the Script tab you can look at the script it's creating, then click the preview button to see the changes. The Script Creator lets you crop and resize, apply IVTC or de-interlace etc, add subtitles, and it creates the script for you, so you don't need to know anything about Avisynth. If you want to add more complex filtering you can add it yourself if you know what you're doing, but looking at the scripts MeGUI creates is a good way to learn the basics of Avisynth if you haven't used it before.

    MeGUI uses a portable version of Avisynth+. To view the scripts it creates with other programs you need to install Avisynth(+). I tend to create scripts with MeGUI, save and open them with MPC-HC. That way I can run them fullscreen with MPC-HC on my monitor or TV (it's connected to my PC) to see how they look before I encode.
    VirtualDub2 is probably a better choice than VirtualDubMod. It's currently maintained and it supports a lot more formats. I'm not sure how different the support for creating scripts is as I never use them for that. Hybrid comes with a lot more Avisynth filters and plugins than MeGUI, but it's not as easy to use. I'd still recommend tying it though. The only other Avisynth based GUI I can think of off the top of my head that's still maintained is StaxRip. AvsPmod helps you create scripts but you really need to know the basics of Avisynth. Handbrake and VidCoder are pretty popular, but they're not Avisynth based and don't give you much control over what they're doing (by comparison).

    If you're re-encoding DVDs ripped with MakeMKV there's an issue to be aware of if they're NTSC. Pal is generally okay. It's a story for another time, but if you remux the video from the MKVs as ts files with TSMuxer and use the ts files as the source for MeGUI, it'll index them with DGIndex and you won't have problems. Unfortunately DGIndex won't index MKVs. DGIndexNV will. MeGUI supports it, but it's not free.

    PS If you're going to play with Avisynth, check out the CropResize function in my signature. It's the only way to crop and resize.
    Last edited by hello_hello; 22nd Apr 2020 at 18:49.
    Quote Quote  
  7. Originally Posted by Flintheart View Post
    The easiest way I've found is the following: MKVToolNix, video - FPS: 24000/1001p, audio and subtitles - stretch by 25025/24000. Is there any reason for not doing it this way?
    Yes. Outside a computer most media players will ignore those settings. Or even worse, only apply one of them, leading to A/V sync problems.
    Quote Quote  
  8. try my clever FFmpeg-GUI. In the Audio modify section you can change your audio stream, with or without pitch correction.
    Quote Quote  
  9. Originally Posted by jagabo View Post
    Originally Posted by Flintheart View Post
    The easiest way I've found is the following: MKVToolNix, video - FPS: 24000/1001p, audio and subtitles - stretch by 25025/24000. Is there any reason for not doing it this way?
    Yes. Outside a computer most media players will ignore those settings. Or even worse, only apply one of them, leading to A/V sync problems.
    Interesting. I wasn't aware of that, but I mostly use a PC for playback and convert all DVDs to h264 anyway. I've almost never watched mpeg2 in an MKV with the TV's media player or a Bluray player. I guess Flintheart will need to check his standalone player, if he's using one.

    If I've changed the frame rate for h264 without re-encoding, I've used the ffmpeg Bitstream Modifier & Muxer, then remuxed with MKVToolNix to change the container frame rate too, although I think the standard ffmpeg has the same functionality now. I gather there's no similar tool for changing mpeg2 frame rate?
    Quote Quote  
  10. Originally Posted by ProWo View Post
    try my clever FFmpeg-GUI. In the Audio modify section you can change your audio stream, with or without pitch correction.
    Just out of curiosity, because I don't use ffmpeg much, which method does it use? I've tried the atempo and rubberband filters (I think only the latter can pitch correct) and remember not being overly impressed with the quality of one of them (I think it was rubberband), but what is your experience with those filters?
    Quote Quote  
  11. Originally Posted by hello_hello View Post
    If I've changed the frame rate for h264 without re-encoding, I've used the ffmpeg Bitstream Modifier & Muxer, then remuxed with MKVToolNix to change the container frame rate too
    That should work for the video. But the audio will go out of sync if the player doesn't apply the corresponding audio adjustment.

    Originally Posted by hello_hello View Post
    I gather there's no similar tool for changing mpeg2 frame rate?
    I think Restream does this.
    Quote Quote  
  12. The plot thickens.

    I've re-encoded the MakeMKV-file with Handbrake. Just playing around to get a smaller file size. I don't think I own any NTSC-DVDs. Is the problem regarding Telecine and the 2:3 pulldown to get the right NTSC-frame rate?

    Is there a good Avisynth+ tutorial? It would be fun to understand the basics, and adjust the audio speed with your script hello_hello. At the moment I don't understand how I'm supposed to use it.
    Quote Quote  
  13. Originally Posted by Flintheart View Post
    The plot thickens.

    I've re-encoded the MakeMKV-file with Handbrake. Just playing around to get a smaller file size. I don't think I own any NTSC-DVDs. Is the problem regarding Telecine and the 2:3 pulldown to get the right NTSC-frame rate?
    Yes. Telecine can be hard-telecine (the telecine is encoded) or soft telecine (the telecine is created while the video is decoded by the way of repeat flags in the video stream). An NTSC DVD can be authored with a combination of hard and soft telecine (and progressive and interlaced). PAL DVDs are generally easier to work with as they're mostly only interlaced or progressive or a combination of the two.

    The two indexers/decoders MeGUI uses by default for MKV, both ignore the repeat flags by default and you can end up with an A/V sync mess. They can be told to honour the repeat flags, but you need to add that to the script yourself. When DGIndex is used for indexing, the repeat flags are honoured by default, so you get telecined video whether it's hard or soft telecine, or a combination of the two, and then an Avisynth filter can be used to reverse the telecine for a progressive output (assuming the source was originally purely progressive such as film).

    Originally Posted by Flintheart View Post
    Is there a good Avisynth+ tutorial? It would be fun to understand the basics, and adjust the audio speed with your script hello_hello. At the moment I don't understand how I'm supposed to use it.
    The only tutorial I know of is on the Avisynth web site.
    MeGUI encodes the audio and video separately in different scripts, so that's one time it's not as useful for creating them. Here's the basics...

    When you install Avisynth, there's a plugins folder in the Program Files (x86)/Avisynth folder. Any plugin (dll) or function (an Avisynth script with an avsi extension rather than avs) in that plugins folder will be loaded by Avisynth when it runs (including MeGUI's portable Avisynth). MeGUI loads plugins manually in the scripts it creates from it's own Avisynth plugins folder. Don't mess with that one.
    I'd stick with the 32 bit Avisynth for the moment. 64 bit Avisynth still doesn't have as many plugins, I don't think. You need to use 32 bit plugins with 32 bit Avisynth and 64 bit plugins with 64 bit Avisynth. I think you downloaded 32 bit MeGUI and it's 32 bit Avisynth, so keep everything the same.

    So if the plugins folder contains ffms2.dll (an indexer/decoder) and my AudioSpeed.avsi script, you can create a script like this. Scripts are simply text files with an avs extension.

    Code:
    ffms2("E:\SomeVideo.mkv", atrack=-1)
    AudioSpeed(24.0/1.001, 25.0, Delay=0, Info=false)
    AssumeFPS(24000, 1001)
    If it's working correctly you can save the above with an avs extension and open it with MPC-HC or VirtualDub2. The first time it's opened, ffms2 will index, so depending on the size of the source there might be a bit of a wait, then the audio and video should open.
    With AudioSpeed configured the way it is above, it'll apply a slowdown to the audio. Setting Info=true will give you info overlaid on the video. Info=true is the default so you need to use Info=false when encoding the video. A delay value other than zero will apply an audio delay (it can be positive or negative) or you can omit the delay argument entirely if you don't need to apply a delay.
    If you're adjusting the audio speed according to frame rate, the first number can be thought of as the new frame rate, with the second number being the original frame rate. Both numbers must be float (with a decimal place). ie 25.0 rather than 25.

    AudioSpeed does it's thing with Avisynth's built in functions. It just combines them into a single function and displays some info to make it easier.

    AssumeFPS is an Avisynth function for speeding up or slowing down the frame rate. It requires a numerator and denominator as integers
    (24000/1001=23.976). Regardless of the original frame rate, the output frame rate will be 23.976fps. AssumeFPS(60, 1) would give you 60fps.

    If you change the order, AudioSpeed will display the new frame rate and video duration rather than the original frame rate and duration, so it might be better to do it that way.

    Code:
    ffms2("E:\SomeVideo.mkv", atrack=-1)
    AssumeFPS(24000, 1001)
    AudioSpeed(24.0/1.001, 25.0, Delay=0, Info=false)
    If you change something in the script, re-open it to preview the change.

    You might want to start with something easier though. Install Avisynth+ and create a script with nothing but the following:

    Code:
    ColorBars()
    Save it with an avs extension and open it with MPC-HC or VirtualDub2 etc, or load it into MeGUI's video section and open the preview. If you see color bars with the first two programs, the installed Avisynth is working. MeGUI will still use it's portable Avisynth unless you tell it not to.
    Last edited by hello_hello; 23rd Apr 2020 at 20:49.
    Quote Quote  
  14. Originally Posted by jagabo View Post
    I think Restream does this.
    Thanks. Something to add to the toolkit for a rainy day.
    Quote Quote  
  15. Originally Posted by jagabo View Post
    Originally Posted by hello_hello View Post
    If I've changed the frame rate for h264 without re-encoding, I've used the ffmpeg Bitstream Modifier & Muxer, then remuxed with MKVToolNix to change the container frame rate too
    That should work for the video. But the audio will go out of sync if the player doesn't apply the corresponding audio adjustment.
    Yeah I only ever use it for video and re-encode the audio while applying a speed change separately.
    Quote Quote  
  16. Originally Posted by jagabo View Post
    Originally Posted by hello_hello View Post
    I gather there's no similar tool for changing mpeg2 frame rate?
    I think Restream does this.
    And DGPulldown, but to the M2V only, requiring demuxing first.

    If for an NTSC DVD, the resolution has to be changed, requiring a reencode. The audio has to be slowed anyway. If for MPG or MKV, no reencoding of the video is required.
    Quote Quote  
  17. Originally Posted by hello_hello View Post
    Just out of curiosity, because I don't use ffmpeg much, which method does it use? I've tried the atempo and rubberband filters (I think only the latter can pitch correct) and remember not being overly impressed with the quality of one of them (I think it was rubberband), but what is your experience with those filters?
    No rubberband. For audio lenght only atempo, for lenght AND pitch aserate.
    Quote Quote  
  18. Thanks for all the help, especially hello_hello, I hope you forgive my ignorance.

    I got the color bars, YAY!

    To output the file, is it correct to load the script into MeGUI and take it from there?

    If that's correct, Avisynth+ doesn't do any encoding, it's purely an editing tool?
    Last edited by Flintheart; 23rd Apr 2020 at 17:31.
    Quote Quote  
  19. Originally Posted by Flintheart View Post
    Thanks for all the help, especially hello_hello, I hope you forgive my ignorance.

    I got the color bars, YAY!

    To output the file, is it correct to load the script into MeGUI and take it from there?
    Yes. If you load a script with both audio and video into MeGUI's video section, I think MeGUI automatically adds it to the audio section too, but you can encode either or both.

    Originally Posted by Flintheart View Post
    If that's correct, Avisynth+ doesn't do any encoding, it's purely an editing tool?
    It's a frame server and functions as a non-linear editor, meaning you can process video in a non-linear fashion. There's lots and lots of plugins and functions for applying all sorts of filtering.
    The video has to be sent to an encoder though. MeGUI supports the Xvid, x264 and x265 encoders. For anything but UHD, I'd use x264. Xvid is pretty much obsolete and x265 doesn't really offer an advantage at lower resolutions, even though it's newer. It's also much slower. For DVD encoding I'd stick with x264. Well... I do.

    As an example of using Avisynth as a NLE, you can use the Trim function to specify ranges of frames to encode. Check out the AVS Cutter under MeGUI's Tools menu. After you create a script you can open it with the AVS Cutter and specify ranges of frames using a preview. You save the cuts to the script and only the specified frame ranges are encoded. You can also combine multiple videos. Something like:

    Code:
    Vid1 = ffms2("E:\SomeVideo.mkv")
    Vid2 = ffms2("E:\AnotherVideo.mkv")
    
    Vid1.Trim(0,854) ++ Vid2.Trim(0,5487) ++ Vid1.Trim(859,4885)
    Or use the Trim function to apply filtering to specific frame ranges.

    Code:
    ffms2("E:\SomeVideo.mkv")
    
    Trim(0,999).Greyscale()+\
    Trim(1000,4587).SomeDenoising()+\
    Trim(4588,6443).SomeDeinterlacing()+\
    Trim(6444,0).SomeDenoising().SomeSharpening()
    It's pretty versatile once you get to know it.
    Last edited by hello_hello; 23rd Apr 2020 at 19:37.
    Quote Quote  
  20. Originally Posted by ProWo View Post
    Originally Posted by hello_hello View Post
    Just out of curiosity, because I don't use ffmpeg much, which method does it use? I've tried the atempo and rubberband filters (I think only the latter can pitch correct) and remember not being overly impressed with the quality of one of them (I think it was rubberband), but what is your experience with those filters?
    No rubberband. For audio lenght only atempo, for lenght AND pitch aserate.
    Thanks. I was unaware of aserate. I'll check it out.

    Edit. Did you mean asetrate? The documentation isn't overly informative. Would you mind posting an example for using it for speedup or slowdown with pitch correction?

    Thanks.
    Last edited by hello_hello; 23rd Apr 2020 at 19:53.
    Quote Quote  
  21. Originally Posted by hello_hello View Post
    Did you mean asetrate? The documentation isn't overly informative. Would you mind posting an example for using it for speedup or slowdown with pitch correction?Thanks.
    https://stackoverflow.com/questions/53374590/ffmpeg-change-tone-frequency-pitch-audio
    Quote Quote  
  22. Originally Posted by ProWo View Post
    Originally Posted by hello_hello View Post
    Just out of curiosity, because I don't use ffmpeg much, which method does it use? I've tried the atempo and rubberband filters (I think only the latter can pitch correct) and remember not being overly impressed with the quality of one of them (I think it was rubberband), but what is your experience with those filters?
    No rubberband. For audio lenght only atempo, for lenght AND pitch aserate.
    After playing around to refresh my memory.... did you mean the other way around? atempo for duration and pitch and asetrate/aresample for duration only?

    I'll confess I had it in my head that atempo doesn't pitch correct because it's been a while since I've used it, but obviously it retains the original pitch.
    I remember now I used rubberband for speedup/slowdown without pitch correction when I created ffmpeg presets for foobar2000, because using asetrate/aresample requires you to specify the sample rate in the command line. Given most speedup/slowdown is applied to 48k audio though, I'll probably create some presets for it.

    Cheers.
    Quote Quote  
  23. Originally Posted by hello_hello View Post
    After playing around to refresh my memory.... did you mean the other way around? atempo for duration and pitch and asetrate/aresample for duration only?
    Lenght change only: -af "atempo=x" (x=coefficient)
    Lenght AND pitch change: -af "asetrate=48000*x" (x=coefficient, 48000=frequency)
    Quote Quote  
  24. I think I was using "pitch" differently. I meant "and pitch correction" but I now see you meant "pitch change", so we're talking about the same thing.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!