VideoHelp Forum




+ Reply to Thread
Results 1 to 12 of 12
  1. Member
    Join Date
    Sep 2013
    Location
    Baltimore
    Search Comp PM
    I am using mencoder to clip avi files, and I have had success in the past, so I think it must have something to do with this particular avi file that I'm trying to clip.

    I have an avi file called Movie.avi and I want to clip from starting position 30 and make it 30 seconds long and call it output.avi. So I run this command:

    Code:
    mencoder -ni -ss 30 -endpos 30 Movie.avi -oac copy -ovc copy -o output.avi


    And the video that it generates has an issue with the video and the audio being out of sync. The output of the mencoder includes this warning:

    Code:
    Too many video packets in the buffer: (280 in 33600000 bytes).
    Code:
    
    Maybe you are playing a non-interleaved stream/file or the codec failed?
    For AVI files, try to force non-interleaved mode with the -ni option.


    The output also, many times, includes stuff like this:
    Code:
    Skipping frame!
    Pos:  29.8s    991f (15%) 128.15fps Trem:   0min 693mb  A-V:0.067 [28803:0]

    And at the very end, the output includes

    Code:
    Video stream: 28771.229 kbit/s  (3596403 B/s)  size: 108000000 bytes  30.030 secs  998 frames
    Code:
    
    
    Audio stream: 4373418.000 kbit/s  (546677276 B/s)  size: 4791968 bytes  0.009 secs


    Any ideas about why the audio and video are not in sync. It seems it is off by like a second or so. I ran this commmand to get some details about the file (not sure if this would help).

    Code:
    mplayer "Movie.avi" -identify -frames 0


    Here is the output

    Code:
    MPlayer SVN-r35910-4.2.1 (C) 2000-2013 MPlayer Team
        
        Playing Movie.avi.
        libavformat version 54.61.104 (internal)
        AVI file format detected.
        AVI: ODML: Building ODML index (1 superindexchunks).
        AVI_NI: No video stream found.
        ID_VIDEO_ID=0
        libavformat file format detected.
        ID_VIDEO_ID=0
        [lavf] stream 0: video (dvvideo), -vid 0
        ID_AUDIO_ID=0
        [lavf] stream 1: audio (pcm_s16le), -aid 0
        ID_AUDIO_ID=1
        [lavf] stream 2: audio (pcm_s16le), -aid 1
        VIDEO:  [dvsd]  720x480  0bpp  29.970 fps  28771.2 kbps (3512.1 kbyte/s)
        Load subtitles in ./
        ID_FILENAME=Movie.avi
        ID_DEMUXER=lavf
        ID_VIDEO_FORMAT=dvsd
        ID_VIDEO_BITRATE=28771224
        ID_VIDEO_WIDTH=720
        ID_VIDEO_HEIGHT=480
        ID_VIDEO_FPS=29.970
        ID_VIDEO_ASPECT=1.3333
        ID_AUDIO_FORMAT=1
        ID_AUDIO_BITRATE=1024000
        ID_AUDIO_RATE=32000
        ID_AUDIO_NCH=2
        ID_START_TIME=0.00
        ID_LENGTH=3556.92
        ID_SEEKABLE=1
        ID_CHAPTERS=0
    =========================================================================
        Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
        libavcodec version 54.91.102 (internal)
        Selected video codec: [ffdv] vfm: ffmpeg (FFmpeg DV)
    =========================================================================
        ID_VIDEO_CODEC=ffdv
    =========================================================================
        Opening audio decoder: [pcm] Uncompressed PCM audio decoder
        AUDIO: 32000 Hz, 2 ch, s16le, 1024.0 kbit/100.00% (ratio: 128000->128000)
        ID_AUDIO_BITRATE=1024000
        ID_AUDIO_RATE=32000
        ID_AUDIO_NCH=2
        Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
    =========================================================================
        AO: [coreaudio] 32000Hz 2ch s16le (2 bytes per sample)
        ID_AUDIO_CODEC=pcm
        Starting playback...
        
    
    
        Exiting... (End of file)
        ID_EXIT=EOF
    Last edited by reising1; 13th Sep 2013 at 18:17.
    Quote Quote  
  2. Probably asking the obvious, but have you tried adding '-ni' like mencoder suggested?
    Quote Quote  
  3. Member
    Join Date
    Sep 2013
    Location
    Baltimore
    Search Comp PM
    Originally Posted by Selur View Post
    Probably asking the obvious, but have you tried adding '-ni' like mencoder suggested?
    Thanks a lot for the reply. Any help is really appreciated. I did try to add an "ni" at the beginning (see updated question, I also added some more output). The -ni didn't seem to make a difference.
    Quote Quote  
  4. The output also, many times, includes stuff like this:
    Skipping frame!

    -> add "-noskip" to your call
    Quote Quote  
  5. Member
    Join Date
    Sep 2013
    Location
    Baltimore
    Search Comp PM
    I have now tried this commandmencoder -noskip -ss 30 -endpos 5 Movie.avi -oac copy -ovc copy -o Output.avi


    And you can see the output here:
    pbs-vsg-robertmacbook:Videos Me$ mencoder -noskip -ss 30 -endpos 5 Movie.avi -oac copy -ovc copy -o Output.avi
    MEncoder SVN-r35910-4.2.1 (C) 2000-2013 MPlayer Team
    success: format: 0 data: 0x0 - 0x5e009c00
    libavformat version 54.61.104 (internal)
    AVI file format detected.
    AVI: ODML: Building ODML index (1 superindexchunks).
    AVI_NI: No video stream found.
    libavformat file format detected.
    [lavf] stream 0: video (dvvideo), -vid 0
    [lavf] stream 1: audio (pcm_s16le), -aid 0
    [lavf] stream 2: audio (pcm_s16le), -aid 1
    VIDEO: [dvsd] 720x480 0bpp 29.970 fps 28771.2 kbps (3512.1 kbyte/s)
    [V] filefmt:35 fourcc:0x64737664 size:720x480 fps:29.970 ftime:=0.0334
    ================================================== ========================
    Opening audio decoder: [pcm] Uncompressed PCM audio decoder
    AUDIO: 32000 Hz, 2 ch, s16le, 1024.0 kbit/100.00% (ratio: 128000->128000)
    Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
    ================================================== ========================
    videocodec: framecopy (720x480 0bpp fourcc=64737664)
    audiocodec: framecopy (format=1 chans=2 rate=32000 bits=16 B/s=128000 sample-0)

    Too many video packets in the buffer: (280 in 33600000 bytes).
    Maybe you are playing a non-interleaved stream/file or the codec failed?
    For AVI files, try to force non-interleaved mode with the -ni option.
    Writing header...
    ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
    Writing header...
    ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
    Pos: 0.7s 21f ( 8%) 0.00fps Trem: 0min 39mb A-V:0.067 [0:0]

    Skipping frame!
    Pos: 1.0s 31f ( 8%) 0.00fps Trem: 0min 50mb A-V:0.067 [0:0]

    Skipping frame!
    Pos: 1.3s 41f ( 8%) 0.00fps Trem: 0min 62mb A-V:0.067 [29528:0]

    Skipping frame!
    Pos: 1.6s 51f ( 8%) 0.00fps Trem: 0min 73mb A-V:0.067 [29383:0]

    Skipping frame!
    Pos: 1.9s 61f ( 8%) 0.00fps Trem: 0min 85mb A-V:0.067 [29285:0]

    Skipping frame!
    Pos: 2.2s 71f ( 8%) 0.00fps Trem: 0min 96mb A-V:0.067 [29213:0]

    Skipping frame!
    Pos: 2.5s 81f ( 8%) 0.00fps Trem: 0min 108mb A-V:0.067 [29160:0]

    Skipping frame!
    Pos: 2.8s 91f ( 8%) 0.00fps Trem: 0min 119mb A-V:0.067 [29117:0]

    Skipping frame!
    Pos: 3.1s 101f ( 8%) 0.00fps Trem: 0min 131mb A-V:0.067 [29083:0]

    Skipping frame!
    Pos: 3.4s 111f ( 8%) 0.00fps Trem: 0min 142mb A-V:0.067 [29056:0]

    Skipping frame!
    Pos: 3.7s 121f ( 8%) 0.00fps Trem: 0min 153mb A-V:0.067 [29032:0]

    Skipping frame!
    Pos: 4.0s 131f ( 8%) 0.00fps Trem: 0min 165mb A-V:0.067 [29013:0]

    Skipping frame!
    Pos: 4.3s 141f ( 8%) 0.00fps Trem: 0min 176mb A-V:0.067 [28996:0]

    Skipping frame!
    Pos: 4.6s 151f ( 8%) 0.00fps Trem: 0min 188mb A-V:0.067 [28981:0]

    Skipping frame!
    Pos: 4.9s 161f ( 8%) 0.00fps Trem: 0min 199mb A-V:0.067 [28968:0]

    Skipping frame!
    Pos: 5.0s 165f ( 8%) 0.00fps Trem: 0min 203mb A-V:0.047 [28964:0]
    Writing index...
    Writing header...
    ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.

    Video stream: 28771.229 kbit/s (3596403 B/s) size: 18000000 bytes 5.005 secs 165 frames

    Audio stream: 4373427.000 kbit/s (546678365 B/s) size: 1191588 bytes 0.002 secs
    Quote Quote  
  6. a. btw. instead of coloring the output better use the [code]-tags
    b. don't remove the '-ni'
    c. you also might want to specify the aspect ratio (iirc. '-aspect 4:3' or similar should do this)
    d. also try if it helps to specify the output frame rate explicitly "-ofps 29.97"
    Quote Quote  
  7. Member
    Join Date
    Sep 2013
    Location
    Baltimore
    Search Comp PM
    Oh, sorry about that, I'll use that tag from now on.

    I added in the ni and the aspectratio and the output is identical.
    Code:
    mencoder -noskip -ni -aspect 4:3  -ss 30 -endpos 5 Movie.avi -oac copy -ovc copy -o okay.avi
    Quote Quote  
  8. does the problem also occur, if you:
    a. add the output frame rate
    b. leave out the range selection "-ss 30 -endpos 5" ?
    c. use "-oac pcm" instead of "-oac copy"
    d. add "-vfm ffmpeg"

    (going to bed now, but these are the 'typical' things I would try)

    Cu Selur
    Last edited by Selur; 13th Sep 2013 at 18:26.
    Quote Quote  
  9. Member
    Join Date
    Sep 2013
    Location
    Baltimore
    Search Comp PM
    Originally Posted by Selur View Post
    does the problem also occur, if you:
    a. add the output frame rate
    b. leave out the range selection "-ss 30 -endpos 5" ?
    c. use "-oac pcm" instead of "-oac copy"
    d. add "-vfm ffmpeg"
    a.
    Code:
    mencoder -noskip -ni -aspect 4:3 -ofps 15 -ss 30 -endpos 5 Movie.avi -oac copy -ovc copy -o okay.avi
    Code:
    MEncoder SVN-r35910-4.2.1 (C) 2000-2013 MPlayer Team
    success: format: 0  data: 0x0 - 0x5e009c00
    libavformat version 54.61.104 (internal)
    AVI file format detected.
    AVI: ODML: Building ODML index (1 superindexchunks).
    AVI_NI: No video stream found.
    libavformat file format detected.
    [lavf] stream 0: video (dvvideo), -vid 0
    [lavf] stream 1: audio (pcm_s16le), -aid 0
    [lavf] stream 2: audio (pcm_s16le), -aid 1
    VIDEO:  [dvsd]  720x480  0bpp  29.970 fps  28771.2 kbps (3512.1 kbyte/s)
    [V] filefmt:35  fourcc:0x64737664  size:720x480  fps:29.970  ftime:=0.0334
    ==========================================================================
    Opening audio decoder: [pcm] Uncompressed PCM audio decoder
    AUDIO: 32000 Hz, 2 ch, s16le, 1024.0 kbit/100.00% (ratio: 128000->128000)
    Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
    ==========================================================================
    videocodec: framecopy (720x480 0bpp fourcc=64737664)
    audiocodec: framecopy (format=1 chans=2 rate=32000 bits=16 B/s=128000 sample-0)
    
    
    Too many video packets in the buffer: (280 in 33600000 bytes).
    Maybe you are playing a non-interleaved stream/file or the codec failed?
    For AVI files, try to force non-interleaved mode with the -ni option.
    Writing header...
    ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
    Writing header...
    ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
    Pos:   2.7s     41f ( 8%)  0.00fps Trem:   0min  64mb  A-V:0.133 [14760:0]
    
    
    Skipping frame!
    Pos:   3.9s     61f ( 8%)  0.00fps Trem:   0min  89mb  A-V:0.134 [14644:0]
    
    
    Skipping frame!
    Pos:   5.0s     78f ( 8%)  0.00fps Trem:   0min 109mb  A-V:0.124 [14592:0]
    Writing index...
    Writing header...
    ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
    
    
    Video stream: 14400.000 kbit/s  (1800000 B/s)  size: 9120000 bytes  5.067 secs  78 frames
    
    
    Audio stream: 4373427.000 kbit/s  (546678365 B/s)  size: 1191588 bytes  0.002 secs
    b.
    LOTS of output now regarding skipping frames and much more output regarding too many video packets in the buffer. Problem definitely still occurs.


    c.
    Code:
    mencoder -ss 15 -endpos 5 Movie.avi -oac pcm -ovc copy -o works.avi


    This is an imporovement! It shows no frames were skipped and it also shows that both the video and audio stream are 5.000 sec. However, on my Mac, in Finder, when I sit over the Output.avi, the preview thingy just shows a black screen, and the icon for the .avi file is also just a generic quicktime icon and not the image from the actual video. When I, however, open the file in VLC, it works great. But...normally when i use this command, in Finder on my Mac, the little preview is not a black screen but rather the first frame from the video. (Let me know if you want to see a picture of this if you don't have Mac).


    d.
    Code:
    mencoder -vfm ffmpeg -ss 15 -endpos 5 Movie.avi -oac pcm -ovc copy -o works.avi



    Same exact thing as C. Same output (5.000 sec for each audio and video), no skipping frames. However, a black preview which is abnormal for all the other avi files I have. NOTE that I have kept the -oac pcm here.
    Quote Quote  
  10. Okay, so the main problem was the audio.
    About the preview: check the file info of both files with mediainfo, my guess is that the fourcc in the avi file changed and Mac OS X therefore doesn't create a preview any more.
    Quote Quote  
  11. Member
    Join Date
    Sep 2013
    Location
    Baltimore
    Search Comp PM
    After working on this practically all night, I came up with this command that produces the clip correct, with high quality, and with the ability to see it in Finder. Your suggestions helped lead me to this solution, so thank you very much!

    The vbitrate comes straight from the mencoder identify frame 0 command.

    Code:
    mencoder -ss 0 -endpos 35 Movie.avi -oac pcm -ovc lavc -lavcopts vcodec=dvvideo:vbitrate=28771224:format=411P -ffourcc dvsd -o works.avi
    Just looking for opinions about this. Does this command seem like a standard, good command? Anything weird with it?
    Quote Quote  
  12. Bitrate seem to be way too high, but other than that it looks okay
    Quote Quote  



Similar Threads

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