VideoHelp Forum
+ Reply to Thread
Results 1 to 22 of 22
Thread
  1. Member
    Join Date
    May 2015
    Location
    Scotland
    Search Comp PM
    Hello,

    I've been trying for the past few days to edit together some downloaded clips in Adobe Premiere Pro. Initially all the clips audio would go out of sync when imported but I discovered that was due to the clips having a variable frame rate so I converted them to a constant frame rate in MEGui. This worked for most but a couple of them seem to have damaged or missing frames that result in the audio going out of sync. The original files stay in sync when played with a media player however.

    I was hoping someone could recommend a way around this problem. Surely if they play in media player and vlc in sync there must be a way to convert them and have the program converting the files fill in the missing frames with repeated frames?

    Thank you.
    Quote Quote  
  2. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    You can try convert with vlc. Under File -> Convert/Save. Try convert to a format that adobe likes...and use constant frame rate.
    Quote Quote  
  3. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    I've had good luck in the past using FFVideoSource for VFR video. Something like this, and then use it to re-encode.
    This usage of ffvideosource with fpsnum and fpsden causes the frame server to create this amount of
    constant frames. 24000/1001 = 23.976

    LoadPlugin("path_to_avisynth_dlls\Lib\ffms2.dll")
    Audio = DirectShowSource("your_path\your_file.mkv", video=false)
    Video = FFVideoSource("your_path\your_file.mkv", track=-1, seekmode=0, fpsnum=24000, fpsden=1001)
    Video = Video.ConvertToYV12()
    AudioDub(Video, Audio)
    Quote Quote  
  4. Member
    Join Date
    May 2015
    Location
    Scotland
    Search Comp PM
    Thanks for the replies, I will try using vlc to convert but to try davexnet's recommendation will take some googling, and quite frankly, I'm too drunk right now for that. Will let you know how I get on tomorrow.

    Thanks again.
    Quote Quote  
  5. Member
    Join Date
    May 2015
    Location
    Scotland
    Search Comp PM
    Ok, once sober it isn't as complicated as it appeared, however I get an error saying that the track is unseekable and vlc just crashes when I try to use it to convert. Suppose I should've give the readout from Media Info when I first posted -

    General
    ID : 1 (0x1)
    Complete name : D:\Downloads\Complete\0.mpeg
    Format : MPEG-TS
    File size : 60.6 MiB
    Duration : 6mn 15s
    Overall bit rate mode : Variable
    Overall bit rate : 1 352 Kbps

    Video
    ID : 256 (0x100)
    Menu ID : 1 (0x1)
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : Main@L3.1
    Format settings, CABAC : No
    Format settings, ReFrames : 1 frame
    Format settings, GOP : M=1, N=10
    Codec ID : 27
    Duration : 6mn 15s
    Width : 800 pixels
    Height : 600 pixels
    Display aspect ratio : 4:3
    Frame rate : 30.000 fps
    Standard : NTSC
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive

    Audio
    ID : 257 (0x101)
    Menu ID : 1 (0x1)
    Format : AAC
    Format/Info : Advanced Audio Codec
    Format version : Version 4
    Format profile : LC
    Muxing mode : ADTS
    Codec ID : 15
    Duration : 6mn 15s
    Bit rate mode : Variable
    Channel(s) : 1 channel
    Channel positions : Front: C
    Sampling rate : 16.0 KHz
    Compression mode : Lossy
    Delay relative to video : 49ms





    On an unrelated note, why is it that a numerator and denominator are used? Why can the frame rate not just be put in as a decimal instead of a fraction? As you can see the files are 30fps so I put in fpsnum=30, fpsden=1, is that correct?

    Thanks.
    Quote Quote  
  6. Try opening MeGUI's script creator and selecting the source file as the video input. When MeGUI asks how you want to open it, select DirectShowSource. Assuming you have a DirectShow codec capable of decoding the video (try installing ffdshow if it doesn't work) you might have more luck that way. For various reasons DirectShowSource isn't generally the best method to use, but sometimes it can work when other methods don't. I've used it for re-encoded corrupted files and there's usually a little "glitch" where the source is corrupted but it's more likely not to effect the audio sync.

    MeGUI should set the frame rate conversion it thinks is required (for DirectShow it's expressed as a number such as 29.970) but unlike indexing with ffms2, there's an option to change the frame rate in the script creator GUI. Apparently that'll change in the future and ffms2 and l-smash will be given frame rate conversion options with the ability to disable it completely in the script creator GUI.

    If DirectShow fails, you could try remuxing the TS file as an MKV with MKVMergeGUI and using it for the source video, but if the TS file is damaged or corrupt that mightn't work either.

    Do you have the Haali Media Splitter installed? I think it's fairly mandatory for MeGUI if you want accurate seeking in TS files.

    Originally Posted by LostRoss View Post
    On an unrelated note, why is it that a numerator and denominator are used? Why can the frame rate not just be put in as a decimal instead of a fraction? As you can see the files are 30fps so I put in fpsnum=30, fpsden=1, is that correct?
    What's MeGUI adding to the script for frame rate conversion? Don't believe what MediaInfo says. Well..... MeGUI gets the frame rate from MediaInfo but more accurately than it's displayed in the MediaInfo GUI, and if it's VFR and it can't work it out MeGUI defaults to 23.976fps.
    In your case the correct frame rate is likely to be 29.970fps as it's the NTSC frame rate. However 29.970fps and 23.976fps are "rounded" frame rates and while they're fairly accurate, expressing them as a numerator and denominator is even more so. ie

    30000/1001 = 29.97002997002997002997002997003
    24000/1001 = 23.976023976023976023976023976024

    For frame rates such as 30fps, the same method is still used. ie 30/1 = 30.
    Last edited by hello_hello; 19th May 2015 at 22:20.
    Quote Quote  
  7. Member
    Join Date
    May 2015
    Location
    Scotland
    Search Comp PM
    Well I've finally got the video to convert and maintain it's length. I was sure I had Haali Media Spliter installed with the Shark 007 codec pack but decided to update the codec pack and install Haali from the link just to be sure. After doing that FFVideoSource worked.

    However, the audio is still not in sync. Have tried all the source options in MEGui and it comes out 10 seconds shorter than the original. I tried just stretching the audio but that doesn't work so I assume the rate is ok but sections are missing. Any recommendations?

    Thanks again.
    Quote Quote  
  8. Member budwzr's Avatar
    Join Date
    Apr 2007
    Location
    City Of Angels
    Search Comp PM
    If the video is VBR, that can throw the audio off too.
    Quote Quote  
  9. Member
    Join Date
    May 2015
    Location
    Scotland
    Search Comp PM
    Originally Posted by budwzr View Post
    If the video is VBR, that can throw the audio off too.
    The video was VBR, as stated at the begining of this thread, but it's now been converted to CBR with the same duration but I can't seem to get the audio converted to be the same duration as the original. I would just mux the original audio to the converted video but the purpose of converting is to import the video (and audio) into Adobe Premiere Pro without desyncing the video and audio, which doesn't work with the original audio track.
    Quote Quote  
  10. Member budwzr's Avatar
    Join Date
    Apr 2007
    Location
    City Of Angels
    Search Comp PM
    Convert the audio to CBR.

    Separating the audio and video does no harm. Doesn't change the timing or duration, except it may correct it.

    Use AviDemux to do this. Convert the audio to PCM or AC-3.
    Last edited by budwzr; 20th May 2015 at 18:24.
    Quote Quote  
  11. Member
    Join Date
    May 2015
    Location
    Scotland
    Search Comp PM
    Originally Posted by budwzr View Post
    Convert the audio to CBR.

    Separating the audio and video does no harm. Doesn't change the timing or duration, except it may correct it.

    Use AviDemux to do this. Convert the audio to PCM or AC-3.
    Separating doesn't, hense why I can demux the original file and mux it with the converted video and have it work in players, but not Adobe Premeire Pro, like the original.

    Never the less, tried with AviDemux with every codec that would work (most said that the audio may not be compatible but some still ran regardless) but all the outputs sounded wierd and echoey.
    Quote Quote  
  12. Member budwzr's Avatar
    Join Date
    Apr 2007
    Location
    City Of Angels
    Search Comp PM
    Well the codec used is probably proprietary in some manner. Does it play correctly in VLC?
    Quote Quote  
  13. You could try keeping it variable frame rate, but I suspect the TS file is damaged/corrupt. Did you try DirectShow for decoding the video and audio?

    I don't know if you can extract timecodes from TS files, or how you'd do it. In fact I'm not even sure TS supports variable frame rate video. I don't think it does but I could be wrong. When video is truly variable frame rate, MediaInfo should say so. It isn't. It says the bitrate is variable but not the frame rate.

    Try remuxing the TS file as an MKV with MKVMergeGUI (you could also try remuxing it with TSMuxer). If MKVMergeGUI offers any warnings it probably means the TS file has problems. Assuming it remuxes fine though, and assuming the video within is variable frame rate, you could extract the video timecodes from the newly created MKV with MKVcleaver or gMKVExtractGUI, open the newly created MKV with MeGUI while removing any frame rate conversion from the script, and the output video should have the exact same number of frames as the source. Then you'd open the encoded video with MKVMergeGUI, add the extracted timecodes to the video track, add the audio and mux. That would give you a new MKV with encoded video that has the same variable bitrate as the source.

    For Avisynth that's really the only two options. Convert to constant frame rate or use the original video timecodes with the encoded video. The conversion to constant frame rate might be more successful with DirectShowSource if the source is corrupted.

    Other than that. Try Handbrake. I'll give it credit for being pretty good with variable frame rate sources. Disable any filters such as IVTC or de-interlacing (unless they're required) and set the output to "variable frame rate", "same as source". Although you should be able to get Handbrake to output a constant frame rate. It's good with VFR sources. Unless they're corrupted, in which case you can't expect too much, but you never know.....
    Quote Quote  
  14. Member
    Join Date
    May 2015
    Location
    Scotland
    Search Comp PM
    Originally Posted by budwzr View Post
    Well the codec used is probably proprietary in some manner. Does it play correctly in VLC?
    Yes, VLC, Media Player Classic and Windows Media Player all play the original in sync but when the original is imported into Adobe Premiere Pro or converted with MEGui or Handbrake the sync goes off. Video stays at 6m15 duration but the audio drops from 6m15 to 6m06 according to MediaInfo and becomes out of sync in all players.
    Quote Quote  
  15. Member budwzr's Avatar
    Join Date
    Apr 2007
    Location
    City Of Angels
    Search Comp PM
    If it plays OK in VLC, then something's wrong with your Premiere install. Maybe corrupted files. Try re-installing Premiere.

    If that doesn't help, you might need a codec pack like K-Lite.
    Quote Quote  
  16. I know it's 60MB but can you upload the file for others to play with? Or you could try splitting it and uploading a smaller sample, assuming when you split it the section you upload still has audio sync problems when it's re-encoded.

    Is the audio sync out by the same amount all the way through? What happens if you open the encoded file with something like MKVMergeGUI and apply a 10 second delay to the audio, then remux?
    Quote Quote  
  17. Member
    Join Date
    May 2015
    Location
    Scotland
    Search Comp PM
    Originally Posted by hello_hello View Post
    You could try keeping it variable frame rate, but I suspect the TS file is damaged/corrupt. Did you try DirectShow for decoding the video and audio?
    Yes I did, worked for the video but the audio went out of sync as usual.

    Originally Posted by hello_hello View Post
    I don't know if you can extract timecodes from TS files, or how you'd do it. In fact I'm not even sure TS supports variable frame rate video. I don't think it does but I could be wrong. When video is truly variable frame rate, MediaInfo should say so. It isn't. It says the bitrate is variable but not the frame rate.

    Try remuxing the TS file as an MKV with MKVMergeGUI (you could also try remuxing it with TSMuxer). If MKVMergeGUI offers any warnings it probably means the TS file has problems. Assuming it remuxes fine though, and assuming the video within is variable frame rate, you could extract the video timecodes from the newly created MKV with MKVcleaver or gMKVExtractGUI, open the newly created MKV with MeGUI while removing any frame rate conversion from the script, and the output video should have the exact same number of frames as the source. Then you'd open the encoded video with MKVMergeGUI, add the extracted timecodes to the video track, add the audio and mux. That would give you a new MKV with encoded video that has the same variable bitrate as the source.

    For Avisynth that's really the only two options. Convert to constant frame rate or use the original video timecodes with the encoded video. The conversion to constant frame rate might be more successful with DirectShowSource if the source is corrupted.
    I've just tried that, MKVMergeGUI managed to remux, I extracted the timecode, recoded video and audio as you instructed and remuxed with the timecodes. I got an error of the video not having enough frames, the file came out to be read as twice the length, the first half played synced and the second was blank (MPC just jumped to end when seeking to second half) but to make things completely pointless Premiere Pro won't import MKV and converting the file again just brought the problem back.


    Originally Posted by hello_hello View Post
    Other than that. Try Handbrake. I'll give it credit for being pretty good with variable frame rate sources. Disable any filters such as IVTC or de-interlacing (unless they're required) and set the output to "variable frame rate", "same as source". Although you should be able to get Handbrake to output a constant frame rate. It's good with VFR sources. Unless they're corrupted, in which case you can't expect too much, but you never know.....
    Tried with Handbrake but it just hung at 35% of the video encoding.

    Originally Posted by budwzr View Post
    If it plays OK in VLC, then something's wrong with your Premiere install. Maybe corrupted files. Try re-installing Premiere.

    If that doesn't help, you might need a codec pack like K-Lite.
    I don't think there is anything wrong with Premiere, it imports other files fine, just it wants to recode or "conform" them and experiences the same problems I am encountering from other recoding software. Plus it is part of the Adobe Suite and to re-install it would mean re-installing the entire suite and I'm not willing to risk loosing all my preferences for all the programs.

    Originally Posted by hello_hello View Post
    I know it's 60MB but can you upload the file for others to play with? Or you could try splitting it and uploading a smaller sample, assuming when you split it the section you upload still has audio sync problems when it's re-encoded.
    I would but I'm afraid that the content isn't exactly family friendly, if you know what I mean. Don't judge me : (

    Originally Posted by hello_hello View Post
    Is the audio sync out by the same amount all the way through? What happens if you open the encoded file with something like MKVMergeGUI and apply a 10 second delay to the audio, then remux?
    The audio is in sync at the begining but goes further out of sync as the video progresses (assuming missing or damaged sections of the audio at different parts).

    Thanks again for everyones time trying to help. Hope it doesn't end up being a waste.
    Quote Quote  
  18. Originally Posted by LostRoss View Post
    Originally Posted by hello_hello View Post
    I don't know if you can extract timecodes from TS files, or how you'd do it. In fact I'm not even sure TS supports variable frame rate video. I don't think it does but I could be wrong. When video is truly variable frame rate, MediaInfo should say so. It isn't. It says the bitrate is variable but not the frame rate.

    Try remuxing the TS file as an MKV with MKVMergeGUI (you could also try remuxing it with TSMuxer). If MKVMergeGUI offers any warnings it probably means the TS file has problems. Assuming it remuxes fine though, and assuming the video within is variable frame rate, you could extract the video timecodes from the newly created MKV with MKVcleaver or gMKVExtractGUI, open the newly created MKV with MeGUI while removing any frame rate conversion from the script, and the output video should have the exact same number of frames as the source. Then you'd open the encoded video with MKVMergeGUI, add the extracted timecodes to the video track, add the audio and mux. That would give you a new MKV with encoded video that has the same variable bitrate as the source.

    For Avisynth that's really the only two options. Convert to constant frame rate or use the original video timecodes with the encoded video. The conversion to constant frame rate might be more successful with DirectShowSource if the source is corrupted.
    I've just tried that, MKVMergeGUI managed to remux, I extracted the timecode, recoded video and audio as you instructed and remuxed with the timecodes. I got an error of the video not having enough frames, the file came out to be read as twice the length, the first half played synced and the second was blank (MPC just jumped to end when seeking to second half) but to make things completely pointless Premiere Pro won't import MKV and converting the file again just brought the problem back.
    To be clear..... MKVMergeGUI did no complaining when you remuxed the TS file as an MKV?
    When you re-encoded the video there was no frame rate conversion in the script?

    Aside from that, you could try extracting the audio with eac3to. Most extraction methods assume the audio is contiguous. If there's gaps it'll go out of sync. Eac3to will look for and try to repair problems it finds when it extracts, and if it finds gaps it'll account for them by replacing them with silence. I can't remember if eac3to will open TS files. It probably does. Failing that though, it'll definitely open MKVs. The HD Streams Extractor under MeGUI's tools menu uses eac3to to do the work. Give it a spin to see if the audio comes out any differently.

    One other thing I could suggest. Don't extract the audio. Open the encoded video with MKVMergeGUI (maybe a version that was converted to a constant frame rate to begin with so the duration should be correct), then add the original TS file. De-select the original video track and remux. That should keep the audio timecodes unchanged. If that doesn't work, try the same again except this time use the remuxed MKV containing the original video and audio. Maybe that'll work. If the MKV you created by remuxing the TS file has synced audio, then it should.

    I had a similar problem a while back and found remuxing without extracting was the only way to fix it. I found where the problem was by opening the MKV with foobar2000 and trying to convert the audio within. It'd progress to a certain point then produce an error. eacto wouldn't fix it for some reason (that's quite unusual, but maybe it wasn't seeing a gap and had no idea there was a section where the audio data was corrupted) and extracting the audio first made it go out of sync at the point. Remuxing without extracting was the only way around it.

    If something like that works, and you still need to import it into Premier there's ways to do it. You could remux it as an MP4, or whatever Premier supports. Even try frame serving to Premier, but that's a whole other story. Actually, you could even try frame serving the original TS file to Premier, but I'll keep that as a whole other story for later if you want to try it.

    Thinking about it, in the "anything's worth a try" department, Video To Video Converter is pretty good at remuxing and it supports lots of file types. Try opening the TS file with it, and when the list of conversion presets pops up, choose "direct stream copy" (it's the last one). On the right, pick a Premier friendly output container and select okay. The job will be added to the conversion queue but it'll just remux when you start the conversion. You never know.....
    Quote Quote  
  19. Member budwzr's Avatar
    Join Date
    Apr 2007
    Location
    City Of Angels
    Search Comp PM
    Looks grim over here. Heading out to greener pastures.
    Quote Quote  
  20. Could you give us the source file(s) info using mediainfo?
    Quote Quote  
  21. Member
    Join Date
    May 2015
    Location
    Scotland
    Search Comp PM
    Holy CRAP!!! Finally!!! Video to Video Converter WORKED!!!!! Thank you so much for sticking with me!

    Just to answer your previous questions -

    Originally Posted by hello_hello View Post
    To be clear..... MKVMergeGUI did no complaining when you remuxed the TS file as an MKV?
    When you re-encoded the video there was no frame rate conversion in the script?
    No complaining and no frame rate conversion in script.

    Originally Posted by hello_hello View Post
    Aside from that, you could try extracting the audio with eac3to. Most extraction methods assume the audio is contiguous. If there's gaps it'll go out of sync. Eac3to will look for and try to repair problems it finds when it extracts, and if it finds gaps it'll account for them by replacing them with silence. I can't remember if eac3to will open TS files. It probably does. Failing that though, it'll definitely open MKVs. The HD Streams Extractor under MeGUI's tools menu uses eac3to to do the work. Give it a spin to see if the audio comes out any differently.
    Tried that before Video to Video but didn't work, wouldn't open the original TS file and after extracting the audio from the MKV that was made with the timecodes, then muxing with converted video the audio was still out of sync.


    Originally Posted by hello_hello View Post
    One other thing I could suggest. Don't extract the audio. Open the encoded video with MKVMergeGUI (maybe a version that was converted to a constant frame rate to begin with so the duration should be correct), then add the original TS file. De-select the original video track and remux. That should keep the audio timecodes unchanged. If that doesn't work, try the same again except this time use the remuxed MKV containing the original video and audio. Maybe that'll work. If the MKV you created by remuxing the TS file has synced audio, then it should.
    The remux with CFM converted video and original did play in sync in media players but still went out of sync when imported into Premiere.

    Originally Posted by hello_hello View Post
    If something like that works, and you still need to import it into Premier there's ways to do it. You could remux it as an MP4, or whatever Premier supports. Even try frame serving to Premier, but that's a whole other story. Actually, you could even try frame serving the original TS file to Premier, but I'll keep that as a whole other story for later if you want to try it.
    Doesn't seem necessary now, with Video to Video Converter working, but still sounds like something that would be useful to know. If you feel extremely generous then I wouldn't mind a link to an article explaining how.

    Once again thanks to everyone who tried to help and especially thanks to hello_hello. Don't know why you bothered to spend so much time trying to help me but I'm glad you did.
    Quote Quote  
  22. Originally Posted by LostRoss View Post
    Once again thanks to everyone who tried to help and especially thanks to hello_hello. Don't know why you bothered to spend so much time trying to help me but I'm glad you did.
    Nothing better to do, I guess.

    I think you can thank ffmpeg for your success there as Video To Video Converter uses it for much of the work.

    The frame serving idea is to provide programs with a file they support for opening a video without the file itself containing any video. Usually that means an AVI. One way to do it is to create a script for opening a video and "wrapping" it into an AVI. Any program capable of opening the AVI can play/edit/re-encode it as usual, while remaining oblivious the the fact the video is coming from Avisynth. You can also extract the audio from the original file, convert it to an AVI friendly format if need be, then mux it into the AVI along with the script. That way any program editing the frame served video can edit the audio to match. A simple example would be wrapping a script into an AVI along with some AC3 audio and opening the AVI in VirtualDub. You could edit out sections and save it as a new AVI using direct stream copy for the audio and video and when the new AVI is opened by another program, it'll see the edited version. Meanwhile, all you have is an AVI that's a couple of MB's in size plus the size of the audio (and obviously still the original file containing the video).

    There's a utility called makeAVIS that usually comes along for the ride when you install ffdshow. There's no shortcut created for it, but you'll find it wherever ffdshow is installed and it'll wrap scripts into AVIs. I think you need to have "Avisynth files" enabled in ffdshow's list of codecs to open the AVI containing the script.

    I mostly use AVS2AVI because it's a tad easier. When it's installed and you right click on a script you'll have a "wrap into AVI" option. Select it and it'll create a small AVI in the same folder as the script. If I need to edit, I open the AVI with VirtualDubMod, add the audio, save that as a new AVI using Direct Stream Copy for the video and audio, and the new AVI can be opened with programs too stupid to open scripts or other file types such as MKV. From memory I think you need to keep the original script, and you can modify it and the AVI you created will frame serve the modified version, but while adding/changing filtering seems to work, changing cropping or resizing seems to require re-wrapping the script into a new AVI or it gets ugly. The program opening the AVI can crop and resize without issue though, you just can't change it in the script. It's been a while since I've used it myself but that's how I remember it.

    I've attached AVS2AVI for you as it's pretty small, but also pretty hard to find these days. It works fine on XP and I've not read any complaints about newer versions of Windows but I've not tested it myself. Have fun!
    Image Attached Files
    Last edited by hello_hello; 21st May 2015 at 20:05.
    Quote Quote  



Similar Threads

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