audio - No video is written in for some part of video as the segmentation from FFmpeg

24
2013-08
  • Russj

    I am segmenting a 20 minutes long video to hundreds of small clips . The command is like

    ffmpeg\\ffmpeg -i nx_1.avi -ss 399.37 -t 1 ka1_2.avi
    

    The ffmpeg is in a subfolder.

    It works very well for most of my video files. The problem is one file, for that file, some segmented clip only has audio, the relevant video obviously not was written into the clip. (Attached the log file below.). But the segmented clips in other part the video are good. Both audio and video are ok. I tried to segment a longer clip to encircle the problematic part of the original video and replay it. The clip plays fine until the problematic part, it froze at the beginning of the problematic part.

    I use ffprobe to probe the avi, it says ODML index invalid. I guess this is the problem.

    How can I solve this problem?


    Log File:

    ffmpeg started on 2013-05-07 at 10:29:33
    Report written to "ffmpeg-20130507-102933.log"
    Command line:
    "ffmpeg\\\\ffmpeg" -i nx_1.avi -ss 399.37 -t 1 ka1_2.avi -report
    ffmpeg version N-51683-g9dc88ac Copyright (c) 2000-2013 the FFmpeg developers
      built on Apr  8 2013 21:22:02 with gcc 4.8.0 (GCC)
      configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
      libavutil      52. 25.100 / 52. 25.100
      libavcodec     55.  2.100 / 55.  2.100
      libavformat    55.  1.100 / 55.  1.100
      libavdevice    55.  0.100 / 55.  0.100
      libavfilter     3. 49.101 /  3. 49.101
      libswscale      2.  2.100 /  2.  2.100
      libswresample   0. 17.102 /  0. 17.102
      libpostproc    52.  2.100 / 52.  2.100
    Splitting the commandline.
    Reading option '-i' ... matched as input file with argument 'nx_1.avi'.
    Reading option '-ss' ... matched as option 'ss' (set the start time offset) with argument '399.37'.
    Reading option '-t' ... matched as option 't' (record or transcode "duration" seconds of audio/video) with argument '1'.
    Reading option 'ka1_2.avi' ... matched as output file.
    Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
    Finished splitting the commandline.
    Parsing a group of options: global .
    Applying option report (generate a report) with argument 1.
    Successfully parsed a group of options.
    Parsing a group of options: input file nx_1.avi.
    Successfully parsed a group of options.
    Opening an input file: nx_1.avi.
    [avi @ 007c8f40] Format avi probed with size=2048 and score=100
    [avi @ 01d9b800] use odml:1
    st:0 removing common factor 400000 from timebase
    [avi @ 007c8f40] File is truncated adjusting duration
    [avi @ 007c8f40] ODML index invalid
    [avi @ 007c8f40] ODML index invalid
    [avi @ 007c8f40] ODML index invalid
    [avi @ 007c8f40] ODML index invalid
    [avi @ 007c8f40] ODML index invalid
    [avi @ 007c8f40] ODML index invalid
    st:1 removing common factor 4 from timebase
    [avi @ 007c8f40] ODML index invalid
    [avi @ 007c8f40] non-interleaved AVI
    [avi @ 007c8f40] File position before avformat_find_stream_info() is 64668
    [avi @ 007c8f40] parser not found for codec dvvideo, packets or times may be invalid.
    [avi @ 007c8f40] parser not found for codec pcm_s16le, packets or times may be invalid.
    [avi @ 007c8f40] parser not found for codec dvvideo, packets or times may be invalid.
    [avi @ 007c8f40] parser not found for codec pcm_s16le, packets or times may be invalid.
    [avi @ 007c8f40] All info found
    [avi @ 007c8f40] File position after avformat_find_stream_info() is 3733036
    Guessed Channel Layout for  Input Stream #0.1 : stereo
    Input #0, avi, from 'nx_1.avi':
      Duration: 00:04:05.12, start: 0.000000, bitrate: 7187 kb/s
        Stream #0:0, 1, 1/25: Video: dvvideo (dvsd / 0x64737664), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
        Stream #0:1, 1, 1/48000: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
    Successfully opened the file.
    Parsing a group of options: output file ka1_2.avi.
    Applying option ss (set the start time offset) with argument 399.37.
    Applying option t (record or transcode "duration" seconds of audio/video) with argument 1.
    Successfully parsed a group of options.
    Opening an output file: ka1_2.avi.
    Successfully opened the file.
    [buffer @ 007c6fe0] Setting entry with key 'video_size' to value '720x576'
    [buffer @ 007c6fe0] Setting entry with key 'pix_fmt' to value '0'
    [buffer @ 007c6fe0] Setting entry with key 'time_base' to value '1/25'
    [buffer @ 007c6fe0] Setting entry with key 'pixel_aspect' to value '16/15'
    [buffer @ 007c6fe0] Setting entry with key 'sws_param' to value 'flags=2'
    [buffer @ 007c6fe0] Setting entry with key 'frame_rate' to value '25/1'
    [graph 0 input from stream 0:0 @ 007cdda0] w:720 h:576 pixfmt:yuv420p tb:1/25 fr:25/1 sar:16/15 sws_param:flags=2
    [AVFilterGraph @ 01d9b2e0] query_formats: 4 queried, 3 merged, 0 already done, 0 delayed
    [abuffer @ 007c6f60] Setting entry with key 'time_base' to value '1/48000'
    [abuffer @ 007c6f60] Setting entry with key 'sample_rate' to value '48000'
    [abuffer @ 007c6f60] Setting entry with key 'sample_fmt' to value 's16'
    [abuffer @ 007c6f60] Setting entry with key 'channel_layout' to value '0x3'
    [graph 1 input from stream 0:1 @ 007ca880] tb:1/48000 samplefmt:s16 samplerate:48000 chlayout:0x3
    [aformat @ 007cde40] Setting entry with key 'sample_fmts' to value 's32p,fltp,s16p'
    [aformat @ 007cde40] Setting entry with key 'sample_rates' to value '44100,48000,32000,22050,24000,16000,11025,12000,8000'
    [aformat @ 007cde40] Setting entry with key 'channel_layouts' to value '0x4,0x3'
    [audio format for output stream 0:1 @ 007ca940] auto-inserting filter 'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and the filter 'audio format for output stream 0:1'
    [AVFilterGraph @ 007c9740] query_formats: 4 queried, 9 merged, 3 already done, 0 delayed
    [auto-inserted resampler 0 @ 007ca9a0] ch:2 chl:stereo fmt:s16 r:48000Hz -> ch:2 chl:stereo fmt:s16p r:48000Hz
    [mpeg4 @ 021f0060] detected 8 logical cores
    [mpeg4 @ 021f0060] intra_quant_bias = 0 inter_quant_bias = -64
    [dvvideo @ 007ccd60] detected 8 logical cores
    Output #0, avi, to 'ka1_2.avi':
      Metadata:
        ISFT            : Lavf55.1.100
        Stream #0:0, 0, 1/25: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 720x576 [SAR 16:15 DAR 4:3], q=2-31, 200 kb/s, 25 tbn, 25 tbc
        Stream #0:1, 0, 3/125: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p
    Stream mapping:
      Stream #0:0 -> #0:0 (dvvideo -> mpeg4)
      Stream #0:1 -> #0:1 (pcm_s16le -> libmp3lame)
    Press [q] to stop, [?] for help
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    frame=    0 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A    
    EOF on sink link output stream 0:0:default.
    No more output streams to write to, finishing.
    [libmp3lame @ 021f0440] Trying to remove 47 more samples than there are in the queue
    frame=    0 fps=0.0 q=0.0 Lsize=      27kB time=00:00:01.03 bitrate= 213.5kbits/s    
    
    video:0kB audio:16kB subtitle:0 global headers:0kB muxing overhead 66.787791%
    [AVIOContext @ 01d9a200] Statistics: 10 seeks, 51 writeouts
    [AVIOContext @ 01d98d20] Statistics: 1566764528 bytes read, 16520 seeks
    
  • Answers
    Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

    Related Question

    terminal - What is the command to cut a portion out of a video and save it using ffmpeg?
  • James

    I've tried

    ffmpeg -t in_movie.avi -ss 00:26:20 -t 00:28:24 out_movie.avi
    

    but that's giving me:

    Invalid duration specification for t: in_movie.avi
    

    Please advise.

    UPDATE: Molly, that command gives:

    FFmpeg version SVN-r19352-4:0.5+svn20090706-2ubuntu2, Copyright (c) 2000-2009 Fabrice Bellard, et al.
      configuration: --extra-version=4:0.5+svn20090706-2ubuntu2 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --extra-cflags=-I/build/buildd/ffmpeg-0.5+svn20090706/debian/include --enable-shared --disable-static
      libavutil     49.15. 0 / 49.15. 0
      libavcodec    52.20. 0 / 52.20. 0
      libavformat   52.31. 0 / 52.31. 0
      libavdevice   52. 1. 0 / 52. 1. 0
      libavfilter    0. 4. 0 /  0. 4. 0
      libswscale     0. 7. 1 /  0. 7. 1
      libpostproc   51. 2. 0 / 51. 2. 0
      built on Oct 13 2009 22:15:16, gcc: 4.4.1
    Input #0, avi, from 'extras.s01.e01.ws.dvdrip.xvid-m00tv.avi':
      Duration: 00:29:04.04, start: 0.000000, bitrate: 1120 kb/s
        Stream #0.0: Video: mpeg4, yuv420p, 640x368 [PAR 1:1 DAR 40:23], 25 tbr, 25 tbn, 25 tbc
        Stream #0.1: Audio: mp3, 48000 Hz, stereo, s16, 32 kb/s
    Output #0, avi, to 'out_movie.avi':
        Stream #0.0: Video: mpeg4, yuv420p, 640x368 [PAR 1:1 DAR 40:23], q=2-31, 200 kb/s, 90k tbn, 25 tbc
        Stream #0.1: Audio: mp2, 48000 Hz, stereo, s16, 64 kb/s
    Stream mapping:
      Stream #0.0 -> #0.0
      Stream #0.1 -> #0.1
    Press [q] to stop encoding
    frame=    0 fps=  0 q=0.0 size=      10kB time=10000000000.00 bitrate=   0.0kbitframe=    0 fps=  0 q=0.0 size=      10kB time=10000000000.00 bitrate=   0.0kbitframe=    0 fps=  0 q=0.0 size=      10kB time=10000000000.00 bitrate=   0.0kbit
    

    And then it appears to freeze. I'd appreciate any help.


  • Related Answers
  • Area 51

    you were pretty close :)

    the correct syntax would be ffmpeg -i InputFile -ss StartTime -t Duration Outputfile

    so try:

    ffmpeg -i in_movie.avi -ss 00:26:20 -t 00:28:24 out_movie.avi
    

    Update

    this episode is about 40:23 long. -t specifies the duration, not the end time. your command will start recording at 26:20 for 28 minutes and 24 seconds, that would be until 54:44. if you want to record from 26:20 to 28:24 use the switch -t 00:02:04 instead.

    ffmpeg -i in_movie.avi -ss 00:26:20 -t 00:02:04 out_movie.avi
    

    now this will give you an AVI clip 2 minutes and 4 seconds long, captured from 26:20 to 28:24