VideoHelp Forum
+ Reply to Thread
Results 1 to 10 of 10
Thread
  1. Member
    Join Date
    Aug 2009
    Location
    Germany
    Search Comp PM
    Hello,

    I'm looking for help on synchronizing audio when cutting a video using an avisynth script containing trim and/or selectRange. After rendering, audio and video never are in sync. I searched the web and found EnsureVBRMP3Sync which should solve this problem. But while I have the sync problem also with constant bitrate audio streams, EnsureVBRMP3Sync does not work but leads to an error.

    This script e.g. does not work:

    DirectShowSource(Titel,fps=FpsZ).EnsureVBRMP3Sync( ).Trim(176500,177000)

    when trying to render it with SUPER.

    And here are some details about my input file:

    Format : Matroska
    File size : 6.56 GiB
    Overall bit rate : 4 809 Kbps

    Video Format : AVC
    Format profile : High@L3.1
    Format settings, CABAC : Yes
    Format settings, ReFrames : 5 frames
    Muxing mode : Container profile=Unknown@3.1
    Codec ID : V_MPEG4/ISO/AVC
    Duration : 3h 15mn
    Bit rate : 4 162 Kbps
    Nominal bit rate : 4 358 Kbps
    Width : 1 280 pixels
    Height : 720 pixels
    Display aspect ratio : 16/9
    Frame rate : 23.976 fps
    Resolution : 24 bits
    Colorimetry : 4:2:0

    Audio Format : AC-3
    Format/Info : Audio Coding 3
    Codec ID : A_AC3
    Duration : 3h 15mn
    Bit rate mode : Constant
    Bit rate : 448 Kbps
    Channel(s) : 6 channels
    Sampling rate : 48.0 KHz

    I'm trying to find a way to cut this video using trim and selectRange while having video and audio in sync.

    Please help me solving this issue,
    Kab09
    Quote Quote  
  2. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by Kab09
    DirectShowSource(Titel,fps=FpsZ).EnsureVBRMP3Sync( ).Trim(176500,177000)
    What is the value of FpsZ and what happens if you omit fps=FpsZ?

    You could try adding seekzero=true to DirectShowSource.
    Quote Quote  
  3. Member
    Join Date
    Aug 2009
    Location
    Germany
    Search Comp PM
    Hi Gavino,

    thanks for your quick replay. FPSZ is the frame rate and when used correctly it works fine.

    Your hint to use SeekZero works well will trim, altough it's quite slow. But with SelectRangeEvery it does not work, the script always causes an error after some seeks.

    Is there also a solution for SelectRangeEvery?

    Thx,
    Kab09.
    Quote Quote  
  4. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    Originally Posted by Kab09
    DirectShowSource(Titel,fps=FpsZ).EnsureVBRMP3Sync( ).Trim(176500,177000)

    Using . to link transforms is compact, but might cause problems with more complex operations like Selectrange, I think.
    Try unrolling it and see if that helps:

    Code:
    DirectShowSource(Titel,fps=FpsZ)
    EnsureVBRMP3Sync()
    Trim(176500,177000)
    You could also try ffmpegsource, which usually works but seems slower.
    Quote Quote  
  5. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by AlanHK
    Using . to link transforms is compact, but might cause problems with more complex operations like Selectrange, I think.
    Try unrolling it and see if that helps
    That should make no difference. Internally, they are both the same filter chain.
    You could also try ffmpegsource, which usually works but seems slower.
    Yes, DirectShowSource is often frame-inaccurate on many formats.
    ffmpegsource builds an index (which makes it slower to start up), providing accuracy.
    You can avoid the delay by re-using the index file on subsequent runs on the same source.
    Quote Quote  
  6. Member
    Join Date
    Aug 2009
    Location
    Germany
    Search Comp PM
    Now I tried FFmpegSource2 by installing the latest version. But by using

    FFmpegSource2(Titel)

    on the above mentioned file I do not get any audio output.

    Do I have to include my audio separately?
    Quote Quote  
  7. FFMpegSource2("video.mkv",atrack=-1)
    Quote Quote  
  8. Member
    Join Date
    Aug 2009
    Location
    Germany
    Search Comp PM
    Originally Posted by poisondeathray
    FFMpegSource2("video.mkv",atrack=-1)
    That does not work at all. Is it possible that FFMpegSource2 is not able not convert AC3 audio or something?
    Quote Quote  
  9. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    See the manual at
    https://spaceboyz.net/svn/aegisub/trunk/FFmpegSource/ffmpegsource.html

    FFmpegSource(string source, int vtrack = -1, int atrack = -2, string timecodes, bool vcache = true, string vcachefile, string acachefile, string pp, int ppquality = 6, int threads = -1, int seekmode = 1)

    atrack & vtrack: Track number as seen by the relevant demuxer, starts from 0, -1 means it will pick the first suitable track and -2 means it's disabled.
    So, as poisondeathray wrote, use "atrack=-1" to get the first audio track.

    ====
    PS: Looks like you have a later version.

    ffmpeg is basically omnivorous.
    It certainly should be able to handle AC3.

    Otherwise, you can try loading them separately, then combining:

    Code:
    A = FFAudioSource(X)
    V = FFVideoSource(X)
    AudioDub(V, A)
    Quote Quote  
  10. Originally Posted by Kab09
    Originally Posted by poisondeathray
    FFMpegSource2("video.mkv",atrack=-1)
    That does not work at all. Is it possible that FFMpegSource2 is not able not convert AC3 audio or something?
    It works here, on avc video , 6ch ac3 audio, mkv container

    Do you have the beta10 in the avisynth plugins directory? ffms2.dll, ffms2.avsi (otherwise you have to split it as alanhk wrote above)

    http://forum.doom9.org/showthread.php?t=127037
    http://code.google.com/p/ffmpegsource

    Another option is to use DGAVCIndex, NicAC3Source and audiodub()
    Quote Quote  



Similar Threads

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