Opened 12 years ago

Closed 12 years ago

#1526 closed defect (invalid)

Got "Truncating packet of size 4096 to 1" at files with long durations when "-ss" at the near the end of file

Reported by: Vladimir Getmanshchuk Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
I'm trying to encode video encoded from dv in avi container to x264 in mp4 container but got error... (please see output below)

If I decreasing start time of input stream from 00:52:37.640 to 00:42:37.640 or lower it start converting.. I have tried to move "-ss" to the end(before output argument) it will shown no errors but it taked to much time for transcoding...

How to reproduce:

/usr/bin/ffmpeg -y -v 9 -loglevel 99 \
-ss 00:52:37.640 -t 367 \
-i "/tmp/converter/2012-05-29-W16/input_file.avi" \
-pass 1 \
-passlogfile "/tmp/converter/2012-05-29-W16/input_file/out_input_file.log" \
-vcodec libx264 \
-x264opts level=3.1:threads=auto \
-vf "yadif,format=yuv420p,scale=iw*sar:ih,fade=in:0:25,fade=out:9150:25,crop=736:560:16:8,setsar=1:1,setdar=736:560" \
-preset slow \
-b:v 1700k \
-an \
-f mp4 \
-threads 0 \
/dev/null

Output:

# /usr/bin/ffmpeg -y -v 9 -loglevel 99 -ss 00:52:37.640 -t 367 -i "/tmp/converter/2012-05-29-W16/input_file.avi" -pass 1 -passlogfile "/tmp/converter/2012-05-29-W16/input_file/out_input_file.log" -vcodec libx264 -x264opts level=3.1:threads=auto -vf "yadif,format=yuv420p,scale=iw*sar:ih,fade=in:0:25,fade=out:9150:25,crop=736:560:16:8,setsar=1:1,setdar=736:560" -preset slow -b:v 1700k -an -f mp4 -threads 0 /dev/null
ffmpeg version N-41702-gc47fc94 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jun 20 2012 05:02:24 with gcc 4.1.2 20080704 (Red Hat 4.1.2-52)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --incdir=/usr/local/include --enable-libfaac --enable-libmp3lame --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-version3 --disable-ffserver --enable-libvpx --enable-runtime-cpudetect
  libavutil      51. 59.100 / 51. 59.100
  libavcodec     54. 25.100 / 54. 25.100
  libavformat    54.  8.100 / 54.  8.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 81.100 /  2. 81.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[avi @ 0x12527120] Format avi probed with size=2048 and score=100
[avi @ 0x12527740] use odml:1
st:0 removing common factor 400000 from timebase
st:1 removing common factor 4 from timebase
[avi @ 0x12527120] non-interleaved AVI
[avi @ 0x12527120] File position before avformat_find_stream_info() is 64668
[avi @ 0x12527120] parser not found for codec dvvideo, packets or times may be invalid.
[avi @ 0x12527120] parser not found for codec pcm_s16le, packets or times may be invalid.
[avi @ 0x12527120] parser not found for codec dvvideo, packets or times may be invalid.
[avi @ 0x12527120] parser not found for codec pcm_s16le, packets or times may be invalid.
[avi @ 0x12527120] All info found
[avi @ 0x12527120] File position after avformat_find_stream_info() is 3733036
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, avi, from '/tmp/converter/2012-05-29-W16/input_file.avi':
  Duration: 01:37:44.72, start: 0.000000, bitrate: 14956 kb/s
    Stream #0:0, 1, 1/25: Video: dvvideo (dvsd / 0x64737664), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 1/25, 25 tbr, 25 tbn, 25 tbc
    Stream #0:1, 1, 1/32000: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 32000 Hz, stereo, s16, 1024 kb/s
[Parsed_yadif_0 @ 0x12528a20] mode:0 parity:-1 auto_enable:0
[Parsed_fade_3 @ 0x1252a260] type:in start_frame:0 nb_frames:25 alpha:0
[Parsed_fade_4 @ 0x1252aea0] type:out start_frame:9150 nb_frames:25 alpha:0
[Parsed_setsar_6 @ 0x1252f3c0] a:1/1
[Parsed_setdar_7 @ 0x1252ad60] a:46/35
[vbuffer source @ 0x1252c9a0] Setting entry with key 'video_size' to value '720x576'
[vbuffer source @ 0x1252c9a0] Setting entry with key 'pix_fmt' to value '0'
[vbuffer source @ 0x1252c9a0] Setting entry with key 'time_base' to value '1/25'
[vbuffer source @ 0x1252c9a0] Setting entry with key 'pixel_aspect' to value '16/15'
[vbuffer source @ 0x1252c9a0] Setting entry with key 'sws_param' to value 'flags=2'
[vbuffer source @ 0x1252c9a0] Setting entry with key 'frame_rate' to value '25/1'
[buffer @ 0x1252bbe0] w:720 h:576 pixfmt:yuv420p tb:1/25 fr:25/1 sar:16/15 sws_param:flags=2
[ffmpeg_buffersink @ 0x1252aa40] No opaque field provided
[Parsed_scale_2 @ 0x12529bc0] w:720 h:576 fmt:yuv420p sar:16/15 -> w:768 h:576 fmt:yuv420p sar:1/1 flags:0x4
[Parsed_crop_5 @ 0x1252b9a0] w:768 h:576 sar:1/1 -> w:736 h:560 sar:1/1
[Parsed_setdar_7 @ 0x1252ad60] w:736 h:560 -> dar:46/35 sar:1/1
[libx264 @ 0x125281e0] using mv_range_thread = 24
[libx264 @ 0x125281e0] using SAR=1/1
[libx264 @ 0x125281e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2
[libx264 @ 0x125281e0] profile Main, level 3.1
[libx264 @ 0x125281e0] 264 - core 125 r2200 999b753 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0 me=dia subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=detected 8 logical cores
Output #0, mp4, to '/dev/null':
  Metadata:
    encoder         : Lavf54.8.100
    Stream #0:0, 0, 1/25: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 736x560 [SAR 1:1 DAR 46:35], 1/25, q=-1--1, pass 1, 1700 kb/s, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (dvvideo -> libx264)
Press [q] to stop, [?] for help
Truncating packet of size 4096 to 1
No more inputs to read from, finishing.
frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=00:00:00.00 bitrate=   0.0kbits/s
video:0kB audio:0kB subtitle:0 global headers:0kB muxing overhead -100.000000%
[libx264 @ 0x125281e0] final ratefactor: 20.28
[AVIOContext @ 0x1252f7a0] Statistics: 2260992 bytes read, 95 seeks

Additional info:

% ffprobe "/tmp/converter/2012-05-29-W16/input_file.avi"
ffprobe version N-41702-gc47fc94 Copyright (c) 2007-2012 the FFmpeg developers
  built on Jun 20 2012 05:02:24 with gcc 4.1.2 20080704 (Red Hat 4.1.2-52)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --incdir=/usr/local/include --enable-libfaac --enable-libmp3lame --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-version3 --disable-ffserver --enable-libvpx --enable-runtime-cpudetect
  libavutil      51. 59.100 / 51. 59.100
  libavcodec     54. 25.100 / 54. 25.100
  libavformat    54.  8.100 / 54.  8.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 81.100 /  2. 81.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[avi @ 0x1e597220] non-interleaved AVI
Input #0, avi, from '/tmp/converter/2012-05-29-W16/input_file.avi':
  Duration: 01:37:44.72, start: 0.000000, bitrate: 14956 kb/s
    Stream #0:0: Video: dvvideo (dvsd / 0x64737664), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 32000 Hz, 2 channels, s16, 1024 kb/s



% ls -lah "/tmp/converter/2012-05-29-W16/input_file.avi"
-rw-r--r-- 1 root root 11G Jul 12 09:25 /tmp/converter/2012-05-29-W16/input_file.avi

Change History (7)

comment:1 by Vladimir Getmanshchuk, 12 years ago

It is looks like similar to http://ffmpeg.org/trac/ffmpeg/ticket/1235

comment:2 by Carl Eugen Hoyos, 12 years ago

Component: undeterminedavcodec
Keywords: start time ffio removed
Version: unspecifiedgit-master

Is the problem also reproducible with "ffmpeg -ss 00:52:37.640 -i /tmp/converter/2012-05-29-W16/input_file.avi -qscale 2 out.avi"?

Could you provide the output of "ffmpeg -i /tmp/converter/2012-05-29-W16/input_file.avi -f null -" (how long is the input sample)?

in reply to:  2 comment:3 by Vladimir Getmanshchuk, 12 years ago

Replying to cehoyos:

Is the problem also reproducible with "ffmpeg -ss 00:52:37.640 -i /tmp/converter/2012-05-29-W16/input_file.avi -qscale 2 out.avi"?

Yep, it is reproducible:

% ffmpeg -ss 00:52:37.640 -i /tmp/converter/2012-05-29-W16/input_file.avi -qscale 2 out.avi
ffmpeg version N-41702-gc47fc94 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jun 20 2012 05:02:24 with gcc 4.1.2 20080704 (Red Hat 4.1.2-52)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --incdir=/usr/local/include --enable-libfaac --enable-libmp3lame --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-version3 --disable-ffserver --enable-libvpx --enable-runtime-cpudetect
  libavutil      51. 59.100 / 51. 59.100
  libavcodec     54. 25.100 / 54. 25.100
  libavformat    54.  8.100 / 54.  8.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 81.100 /  2. 81.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[avi @ 0x3ea8120] non-interleaved AVI
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, avi, from '/tmp/converter/2012-05-29-W16/input_file.avi':
  Duration: 01:37:44.72, start: 0.000000, bitrate: 14956 kb/s
    Stream #0:0: Video: dvvideo (dvsd / 0x64737664), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 32000 Hz, stereo, s16, 1024 kb/s
Please use -q:a or -q:v, -qscale is ambiguous
[buffer @ 0x3ead7a0] w:720 h:576 pixfmt:yuv420p tb:1/25 fr:25/1 sar:16/15 sws_param:flags=2
[ffmpeg_buffersink @ 0x3ee35e0] No opaque field provided
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf54.8.100
    Stream #0:0: 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: Audio: mp3 (U[0][0][0] / 0x0055), 32000 Hz, stereo, s16
Stream mapping:
  Stream #0:0 -> #0:0 (dvvideo -> mpeg4)
  Stream #0:1 -> #0:1 (pcm_s16le -> libmp3lame)
Press [q] to stop, [?] for help
Truncating packet of size 4096 to 1
[libmp3lame @ 0x3eacd80] Trying to remove 1152 samples, but que empty
[avi @ 0x3eafda0] Encoder did not produce proper pts, making some up.
frame=    0 fps=0.0 q=0.0 Lsize=      10kB time=00:00:00.00 bitrate=   0.0kbits/s
video:0kB audio:0kB subtitle:0 global headers:0kB muxing overhead 2319.444444%

Same, but new type of argument -"-q:v 2":

% ffmpeg -ss 00:52:37.640 -i /tmp/converter/2012-05-29-W16/input_file.avi -q:v 2 out.avi
ffmpeg version N-41702-gc47fc94 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jun 20 2012 05:02:24 with gcc 4.1.2 20080704 (Red Hat 4.1.2-52)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --incdir=/usr/local/include --enable-libfaac --enable-libmp3lame --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-version3 --disable-ffserver --enable-libvpx --enable-runtime-cpudetect
  libavutil      51. 59.100 / 51. 59.100
  libavcodec     54. 25.100 / 54. 25.100
  libavformat    54.  8.100 / 54.  8.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 81.100 /  2. 81.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[avi @ 0x75d7120] non-interleaved AVI
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, avi, from '/tmp/converter/2012-05-29-W16/input_file.avi':
  Duration: 01:37:44.72, start: 0.000000, bitrate: 14956 kb/s
    Stream #0:0: Video: dvvideo (dvsd / 0x64737664), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 32000 Hz, stereo, s16, 1024 kb/s
File 'out.avi' already exists. Overwrite ? [y/N] y
w:720 h:576 pixfmt:yuv420p tb:1/25 fr:25/1 sar:16/15 sws_param:flags=2
[ffmpeg_buffersink @ 0x76125e0] No opaque field provided
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf54.8.100
    Stream #0:0: 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: Audio: mp3 (U[0][0][0] / 0x0055), 32000 Hz, stereo, s16
Stream mapping:
  Stream #0:0 -> #0:0 (dvvideo -> mpeg4)
  Stream #0:1 -> #0:1 (pcm_s16le -> libmp3lame)
Press [q] to stop, [?] for help
Truncating packet of size 4096 to 1
[libmp3lame @ 0x75dbd80] Trying to remove 1152 samples, but que empty
[avi @ 0x75deda0] Encoder did not produce proper pts, making some up.
frame=    0 fps=0.0 q=0.0 Lsize=      10kB time=00:00:00.00 bitrate=   0.0kbits/s
video:0kB audio:0kB subtitle:0 global headers:0kB muxing overhead 2319.444444%

Could you provide the output of "ffmpeg -i /tmp/converter/2012-05-29-W16/input_file.avi -f null -" (how long is the input sample)?

% ffmpeg -i /tmp/converter/2012-05-29-W16/input_file.avi -f null -
ffmpeg version N-41702-gc47fc94 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jun 20 2012 05:02:24 with gcc 4.1.2 20080704 (Red Hat 4.1.2-52)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --incdir=/usr/local/include --enable-libfaac --enable-libmp3lame --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-version3 --disable-ffserver --enable-libvpx --enable-runtime-cpudetect
  libavutil      51. 59.100 / 51. 59.100
  libavcodec     54. 25.100 / 54. 25.100
  libavformat    54.  8.100 / 54.  8.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 81.100 /  2. 81.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[avi @ 0x464d120] non-interleaved AVI
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, avi, from '/tmp/converter/2012-05-29-W16/input_file.avi':
  Duration: 01:37:44.72, start: 0.000000, bitrate: 14956 kb/s
    Stream #0:0: Video: dvvideo (dvsd / 0x64737664), yuv420p, 720x576 [SAR 16:15
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 32000 Hz, stereo, s16
[buffer @ 0x464ed20] w:720 h:576 pixfmt:yuv420p tb:1/25 fr:25/1 sar:16/15 sws_p
[ffmpeg_buffersink @ 0x464fcc0] No opaque field provided
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf54.8.100
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 720x576 [SAR 16:
    Stream #0:1: Audio: pcm_s16le, 32000 Hz, stereo, s16, 1024 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (dvvideo -> rawvideo)
  Stream #0:1 -> #0:1 (pcm_s16le -> pcm_s16le)
Press [q] to stop, [?] for help
[null @ 0x4654a20] Encoder did not produce proper pts, making some up.
frame= 3882 fps= 59 q=0.0 size=       0kB time=00:02:35.28 bitrate=   0.0kbits/                                                                                                                      frame= 3890 fps= 58 q=0.0 size=       0kB time=00:02:35.60 bitrate=   0.0kbits/                                                                                                                      frame= 3899 fps= 58 q=0.0 size=       0kB time=00:02:35.96 bitrate=   0.0kbits/                                                                                                                      frame= 3908 fps= 58 q=0.0 size=       0kB time=00:02:36.32 bitrate=   0.0kbits/                                                                                                                      frame= 3916 fps= 57 q=0.0 size=       0kB time=00:02:36.64 bitrate=   0.0kbits/                                                                                                                      frame= 3924 fps= 57 q=0.0 size=       0kB time=00:02:36.96 bitrate=   0.0kbits/                                                                                                                      frame= 3930 fps= 57 q=0.0 size=       0kB time=00:02:37.20 bitrate=   0.0kbits/                                                                                                                      frame= 3982 fps= 57 q=0.0 size=       0kB time=00:02:39.28 bitrate=   0.0kbits/                                                                                                                      frame= 3991 fps= 57 q=0.0 size=       0kB time=00:02:39.64 bitrate=   0.0kbits/                                                                                                                      frame= 3999 fps= 56 q=0.0 size=       0kB time=00:02:39.96 bitrate=   0.0kbits/                                                                                                                      frame= 4019 fps= 56 q=0.0 size=       0kB time=00:02:40.76 bitrate=   0.0kbits/                                                                                                                      frame= 4060 fps= 55 q=0.0 size=       0kB time=00:02:42.40 bitrate=   0.0kbits/                                                                                                                      frame= 4067 fps= 55 q=0.0 size=       0kB time=00:02:42.67 bitrate=   0.0kbits/                                                                                                                      frame= 4078 fps= 54 q=0.0 size=       0kB time=00:02:43.12 bitrate=   0.0kbits/                                                                                                                      frame= 4086 fps= 54 q=0.0 size=       0kB time=00:02:43.44 bitrate=   0.0kbits/s                                                                                                                     frame= 4093 fps= 54 q=0.0 size=       0kB time=00:02:43.72 bitrate=   0.0kbits/s                                                                                                                     frame= 4100 fps= 54 q=0.0 size=       0kB time=00:02:43.99 bitrate=   0.0kbits/s                                                                                                                     Truncating packet of size 4096 to 1   0kB time=00:48:59.92 bitrate=   0.0kbits/s
frame=73501 fps= 35 q=0.0 Lsize=       0kB time=00:49:00.00 bitrate=   0.0kbits/s
video:6891kB audio:367500kB subtitle:0 global headers:0kB muxing overhead -100.000000%

hmm.... I guess problem in source file, am I right?

comment:4 by Carl Eugen Hoyos, 12 years ago

Component: avcodecundetermined

FFmpeg says the source file is 49 minutes long which makes seeking to 52 minutes impossible.
Is the file actually longer?

in reply to:  4 comment:5 by Vladimir Getmanshchuk, 12 years ago

Replying to cehoyos:

FFmpeg says the source file is 49 minutes long which makes seeking to 52 minutes impossible.
Is the file actually longer?

Yes, it is. You can see output of ffmpeg and ffprobe. Both show correct duration:
Duration: 01:37:44.72

comment:6 by Vladimir Getmanshchuk, 12 years ago

Guys, thank you every one for your help!
I'm really sorry!
Issue was with broken source video file.. My bad - I excluded file consistent check based on some info which I sured in. But it was wrong info...

..so ffmpeg/ffprobe got duration info from header/container info... Right?

in reply to:  6 comment:7 by Carl Eugen Hoyos, 12 years ago

Resolution: invalid
Status: newclosed

Replying to vladget:

Guys, thank you every one for your help!
I'm really sorry!
Issue was with broken source video file.. My bad - I excluded file consistent check based on some info which I sured in. But it was wrong info...

I am closing the ticket, if I misunderstand, please reopen.

..so ffmpeg/ffprobe got duration info from header/container info... Right?

Cut the file radically with dd to find out.

Note: See TracTickets for help on using tickets.