[FFmpeg-user] AAC packet too short

Maxence Dolle contact at maxdolle.fr
Sat Mar 18 15:15:00 EET 2017


Hi,

I'm struggling a lot with a rtsp input stream that I try to save as 
mpegts without reencoding. Using the exact same command, it sometimes 
run well, but often crashes right from the start.

The only difference I see between a successful and a failed run are the 
two lines:
[mpegts @ 0x4ddfa60] AAC packet too short
av_interleaved_write_frame(): Invalid data found when processing input

So I guess I'm getting malformed packets, do you have any idea of a 
workaround here?
Does it have to do with pts?

Thanks!

######## FAILED RUN

/opt/ffmpeg/ffmpeg -analyzeduration 5000000 -probesize 5000000 -i 
'rtsp://my-input' -map i:1001? -map i:1002? -map i:1003? -map i:1004? 
-map i:1005? -map i:1006? -map i:1007? -map i:1008? -map i:1009? -map 
i:1010? -map i:1011? -map i:1012? -map i:1013? -map i:1014? -map i:1015? 
-map i:1016? -map i:1017? -map i:1018? -map i:1019? -map i:1020? 
-codec:a copy -map 0:v -codec:v copy -to 00:00:30 -f mpegts -y out.ts
ffmpeg version 3.2.4-static http://johnvansickle.com/ffmpeg/  Copyright 
(c) 2000-2017 the FFmpeg developers
   built with gcc 5.4.1 (Debian 5.4.1-5) 20170205
   configuration: --enable-gpl --enable-version3 --enable-static 
--disable-debug --disable-ffplay --disable-indev=sndio 
--disable-outdev=sndio --cc=gcc-5 --enable-fontconfig --enable-frei0r 
--enable-gnutls --enable-gray --enable-libass --enable-libfreetype 
--enable-libfribidi --enable-libmp3lame --enable-libopencore-amrnb 
--enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus 
--enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora 
--enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis 
--enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 
--enable-libxvid --enable-libzimg
   libavutil      55. 34.101 / 55. 34.101
   libavcodec     57. 64.101 / 57. 64.101
   libavformat    57. 56.101 / 57. 56.101
   libavdevice    57.  1.100 / 57.  1.100
   libavfilter     6. 65.100 /  6. 65.100
   libswscale      4.  2.100 /  4.  2.100
   libswresample   2.  3.100 /  2.  3.100
   libpostproc    54.  1.100 / 54.  1.100
[aac @ 0x4cea6e0] Multiple frames in a packet.
[aac @ 0x4cea6e0] Sample rate index in program config element does not 
match the sample rate index configured by the container.
[aac @ 0x4cea6e0] decode_pce: Input buffer exhausted before END element 
found
[aac @ 0x4ceea00] Sample rate index in program config element does not 
match the sample rate index configured by the container.
[aac @ 0x4ceea00] decode_pce: Input buffer exhausted before END element 
found
[aac @ 0x4cf1d60] Sample rate index in program config element does not 
match the sample rate index configured by the container.
[aac @ 0x4cf1d60] decode_pce: Input buffer exhausted before END element 
found
[NULL @ 0x4cb8a00] non-existing PPS 0 referenced
[h264 @ 0x4cb8a00] non-existing PPS 0 referenced
[h264 @ 0x4cb8a00] decode_slice_header error
[h264 @ 0x4cb8a00] no frame!
[h264 @ 0x4cb8a00] non-existing PPS 0 referenced
     Last message repeated 1 times
[h264 @ 0x4cb8a00] decode_slice_header error
[h264 @ 0x4cb8a00] no frame!
[h264 @ 0x4cb8a00] non-existing PPS 0 referenced
     Last message repeated 1 times
[h264 @ 0x4cb8a00] decode_slice_header error
[h264 @ 0x4cb8a00] no frame!
[h264 @ 0x4cb8a00] non-existing PPS 0 referenced
     Last message repeated 1 times
[h264 @ 0x4cb8a00] decode_slice_header error
[h264 @ 0x4cb8a00] no frame!
[h264 @ 0x4cb8a00] non-existing PPS 0 referenced
     Last message repeated 1 times
[h264 @ 0x4cb8a00] decode_slice_header error
[h264 @ 0x4cb8a00] no frame!
[h264 @ 0x4cb8a00] non-existing PPS 0 referenced
     Last message repeated 1 times
[h264 @ 0x4cb8a00] decode_slice_header error
[h264 @ 0x4cb8a00] no frame!
Input #0, rtsp, from 'rtsp://my-input':
   Metadata:
     title           : unknown
     comment         : unknown
   Duration: N/A, start: 44609.301122, bitrate: N/A
   Program 56612
     Stream #0:1: Video: h264 (High) ([27][0][0][0] / 0x001B), 
yuv420p(progressive), 480x576 [SAR 8:5 DAR 4:3], 25 fps, 25 tbr, 90k 
tbn, 50 tbc
     Stream #0:19(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 
31 kb/s
     Stream #0:0(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 32 
kb/s
     Stream #0:8(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 32 
kb/s
     Stream #0:4(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 34 
kb/s
     Stream #0:5(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 33 
kb/s
     Stream #0:14(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 
30 kb/s
     Stream #0:7(fra): Audio: aac (HE-AACv2) ([15][0][0][0] / 0x000F), 
48000 Hz, stereo, fltp, 30 kb/s
     Stream #0:15(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 
34 kb/s
     Stream #0:10(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 
32 kb/s
     Stream #0:11: Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 33 kb/s
     Stream #0:16: Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 30 kb/s
     Stream #0:3: Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 32 kb/s
     Stream #0:2(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 35 
kb/s
     Stream #0:13(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 
33 kb/s
     Stream #0:20(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 
32 kb/s
     Stream #0:18(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 
33 kb/s
     Stream #0:9(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 35 
kb/s
     Stream #0:6(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 30 
kb/s
     Stream #0:12(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 
32 kb/s
     Stream #0:17(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 
31 kb/s
Output #0, mpegts, to 'out.ts':
   Metadata:
     title           : unknown
     comment         : unknown
     encoder         : Lavf57.56.101
     Stream #0:0(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 31 kb/s
     Stream #0:1(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 32 kb/s
     Stream #0:2(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 32 kb/s
     Stream #0:3(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 34 kb/s
     Stream #0:4(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 33 kb/s
     Stream #0:5(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 30 kb/s
     Stream #0:6(fra): Audio: aac (HE-AACv2) ([15][0][0][0] / 0x000F), 
48000 Hz, stereo, 30 kb/s
     Stream #0:7(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 34 kb/s
     Stream #0:8(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 32 kb/s
     Stream #0:9: Audio: aac (HE-AACv2), 48000 Hz, stereo, 33 kb/s
     Stream #0:10: Audio: aac (HE-AACv2), 48000 Hz, stereo, 30 kb/s
     Stream #0:11: Audio: aac (HE-AACv2), 48000 Hz, stereo, 32 kb/s
     Stream #0:12(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 35 kb/s
     Stream #0:13(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 33 kb/s
     Stream #0:14(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 32 kb/s
     Stream #0:15(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 33 kb/s
     Stream #0:16(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 35 kb/s
     Stream #0:17(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 30 kb/s
     Stream #0:18(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 32 kb/s
     Stream #0:19(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 31 kb/s
     Stream #0:20: Video: h264 (High) ([27][0][0][0] / 0x001B), 
yuv420p(progressive), 480x576 [SAR 8:5 DAR 4:3], q=2-31, 25 fps, 25 tbr, 
90k tbn, 90k tbc
Stream mapping:
   Stream #0:19 -> #0:0 (copy)
   Stream #0:0 -> #0:1 (copy)
   Stream #0:8 -> #0:2 (copy)
   Stream #0:4 -> #0:3 (copy)
   Stream #0:5 -> #0:4 (copy)
   Stream #0:14 -> #0:5 (copy)
   Stream #0:7 -> #0:6 (copy)
   Stream #0:15 -> #0:7 (copy)
   Stream #0:10 -> #0:8 (copy)
   Stream #0:11 -> #0:9 (copy)
   Stream #0:16 -> #0:10 (copy)
   Stream #0:3 -> #0:11 (copy)
   Stream #0:2 -> #0:12 (copy)
   Stream #0:13 -> #0:13 (copy)
   Stream #0:20 -> #0:14 (copy)
   Stream #0:18 -> #0:15 (copy)
   Stream #0:9 -> #0:16 (copy)
   Stream #0:6 -> #0:17 (copy)
   Stream #0:12 -> #0:18 (copy)
   Stream #0:17 -> #0:19 (copy)
   Stream #0:1 -> #0:20 (copy)
Press [q] to stop, [?] for help
[mpegts @ 0x4ddfa60] AAC bitstream not in ADTS format and extradata missing
     Last message repeated 15 times
[mpegts @ 0x4ddfa60] AAC packet too short
av_interleaved_write_frame(): Invalid data found when processing input
[mpegts @ 0x4ddfa60] AAC bitstream not in ADTS format and extradata missing
     Last message repeated 1 times
frame=    1 fps=0.0 q=-1.0 Lsize=     123kB time=00:00:01.06 bitrate= 
948.6kbits/s speed= 588x
video:68kB audio:44kB subtitle:0kB other streams:0kB global headers:0kB 
muxing overhead: 9.687434%
Conversion failed!


######## SUCCESSFUL RUN
/opt/ffmpeg/ffmpeg -analyzeduration 5000000 -probesize 5000000 -i 
'rtsp://my-input' -map i:1001? -map i:1002? -map i:1003? -map i:1004? 
-map i:1005? -map i:1006? -map i:1007? -map i:1008? -map i:1009? -map 
i:1010? -map i:1011? -map i:1012? -map i:1013? -map i:1014? -map i:1015? 
-map i:1016? -map i:1017? -map i:1018? -map i:1019? -map i:1020? 
-codec:a copy -map 0:v -codec:v copy -to 00:00:30 -f mpegts -y out.ts
ffmpeg version 3.2.4-static http://johnvansickle.com/ffmpeg/  Copyright 
(c) 2000-2017 the FFmpeg developers
   built with gcc 5.4.1 (Debian 5.4.1-5) 20170205
   configuration: --enable-gpl --enable-version3 --enable-static 
--disable-debug --disable-ffplay --disable-indev=sndio 
--disable-outdev=sndio --cc=gcc-5 --enable-fontconfig --enable-frei0r 
--enable-gnutls --enable-gray --enable-libass --enable-libfreetype 
--enable-libfribidi --enable-libmp3lame --enable-libopencore-amrnb 
--enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus 
--enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora 
--enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis 
--enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 
--enable-libxvid --enable-libzimg
   libavutil      55. 34.101 / 55. 34.101
   libavcodec     57. 64.101 / 57. 64.101
   libavformat    57. 56.101 / 57. 56.101
   libavdevice    57.  1.100 / 57.  1.100
   libavfilter     6. 65.100 /  6. 65.100
   libswscale      4.  2.100 /  4.  2.100
   libswresample   2.  3.100 /  2.  3.100
   libpostproc    54.  1.100 / 54.  1.100
[aac @ 0x42d6e60] Multiple frames in a packet.
[aac @ 0x42d9720] Multiple frames in a packet.
[aac @ 0x42d9720] Sample rate index in program config element does not 
match the sample rate index configured by the container.
[aac @ 0x42d9720] decode_pce: Input buffer exhausted before END element 
found
[aac @ 0x42ea100] Sample rate index in program config element does not 
match the sample rate index configured by the container.
[aac @ 0x42ea100] decode_pce: Input buffer exhausted before END element 
found
[aac @ 0x42ec9c0] Multiple frames in a packet.
[aac @ 0x42eb560] Multiple frames in a packet.
[NULL @ 0x42ee180] non-existing PPS 0 referenced
[h264 @ 0x42ee180] non-existing PPS 0 referenced
[h264 @ 0x42ee180] decode_slice_header error
[h264 @ 0x42ee180] no frame!
[h264 @ 0x42ee180] non-existing PPS 0 referenced
     Last message repeated 1 times
[h264 @ 0x42ee180] decode_slice_header error
[h264 @ 0x42ee180] no frame!
[h264 @ 0x42ee180] non-existing PPS 0 referenced
     Last message repeated 1 times
[h264 @ 0x42ee180] decode_slice_header error
[h264 @ 0x42ee180] no frame!
[h264 @ 0x42ee180] non-existing PPS 0 referenced
     Last message repeated 1 times
[h264 @ 0x42ee180] decode_slice_header error
[h264 @ 0x42ee180] no frame!
[h264 @ 0x42ee180] non-existing PPS 0 referenced
     Last message repeated 1 times
[h264 @ 0x42ee180] decode_slice_header error
[h264 @ 0x42ee180] no frame!
Input #0, rtsp, from 'rtsp://my-input':
   Metadata:
     title           : unknown
     comment         : unknown
   Duration: N/A, start: 44610.338300, bitrate: N/A
   Program 56612
     Stream #0:20: Video: h264 (High) ([27][0][0][0] / 0x001B), 
yuv420p(progressive), 480x576 [SAR 8:5 DAR 4:3], 25 fps, 25 tbr, 90k 
tbn, 50 tbc
     Stream #0:18(fra): Audio: aac (HE-AACv2) ([15][0][0][0] / 0x000F), 
48000 Hz, stereo, fltp, 32 kb/s
     Stream #0:0(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 32 
kb/s
     Stream #0:7(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 32 
kb/s
     Stream #0:4(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 28 
kb/s
     Stream #0:6(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 30 
kb/s
     Stream #0:13(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 
30 kb/s
     Stream #0:5(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 32 
kb/s
     Stream #0:14(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 
32 kb/s
     Stream #0:9(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 32 
kb/s
     Stream #0:10: Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 29 kb/s
     Stream #0:16: Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 32 kb/s
     Stream #0:2: Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 33 kb/s
     Stream #0:1(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 30 
kb/s
     Stream #0:12(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 
31 kb/s
     Stream #0:19(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 
34 kb/s
     Stream #0:15(fra): Audio: aac (HE-AACv2) ([15][0][0][0] / 0x000F), 
48000 Hz, stereo, fltp, 32 kb/s
     Stream #0:8(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 32 
kb/s
     Stream #0:3(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 29 
kb/s
     Stream #0:11(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 
32 kb/s
     Stream #0:17(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, fltp, 
32 kb/s
Output #0, mpegts, to 'out.ts':
   Metadata:
     title           : unknown
     comment         : unknown
     encoder         : Lavf57.56.101
     Stream #0:0(fra): Audio: aac (HE-AACv2) ([15][0][0][0] / 0x000F), 
48000 Hz, stereo, 32 kb/s
     Stream #0:1(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 32 kb/s
     Stream #0:2(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 32 kb/s
     Stream #0:3(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 28 kb/s
     Stream #0:4(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 30 kb/s
     Stream #0:5(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 30 kb/s
     Stream #0:6(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 32 kb/s
     Stream #0:7(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 32 kb/s
     Stream #0:8(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 32 kb/s
     Stream #0:9: Audio: aac (HE-AACv2), 48000 Hz, stereo, 29 kb/s
     Stream #0:10: Audio: aac (HE-AACv2), 48000 Hz, stereo, 32 kb/s
     Stream #0:11: Audio: aac (HE-AACv2), 48000 Hz, stereo, 33 kb/s
     Stream #0:12(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 30 kb/s
     Stream #0:13(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 31 kb/s
     Stream #0:14(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 34 kb/s
     Stream #0:15(fra): Audio: aac (HE-AACv2) ([15][0][0][0] / 0x000F), 
48000 Hz, stereo, 32 kb/s
     Stream #0:16(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 32 kb/s
     Stream #0:17(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 29 kb/s
     Stream #0:18(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 32 kb/s
     Stream #0:19(fra): Audio: aac (HE-AACv2), 48000 Hz, stereo, 32 kb/s
     Stream #0:20: Video: h264 (High) ([27][0][0][0] / 0x001B), 
yuv420p(progressive), 480x576 [SAR 8:5 DAR 4:3], q=2-31, 25 fps, 25 tbr, 
90k tbn, 90k tbc
Stream mapping:
   Stream #0:18 -> #0:0 (copy)
   Stream #0:0 -> #0:1 (copy)
   Stream #0:7 -> #0:2 (copy)
   Stream #0:4 -> #0:3 (copy)
   Stream #0:6 -> #0:4 (copy)
   Stream #0:13 -> #0:5 (copy)
   Stream #0:5 -> #0:6 (copy)
   Stream #0:14 -> #0:7 (copy)
   Stream #0:9 -> #0:8 (copy)
   Stream #0:10 -> #0:9 (copy)
   Stream #0:16 -> #0:10 (copy)
   Stream #0:2 -> #0:11 (copy)
   Stream #0:1 -> #0:12 (copy)
   Stream #0:12 -> #0:13 (copy)
   Stream #0:19 -> #0:14 (copy)
   Stream #0:15 -> #0:15 (copy)
   Stream #0:8 -> #0:16 (copy)
   Stream #0:3 -> #0:17 (copy)
   Stream #0:11 -> #0:18 (copy)
   Stream #0:17 -> #0:19 (copy)
   Stream #0:20 -> #0:20 (copy)
Press [q] to stop, [?] for help
[mpegts @ 0x44a8d20] AAC bitstream not in ADTS format and extradata missing
     Last message repeated 22 times
[mpegts @ 0x44a8d20] Non-monotonous DTS in output stream 0:4; previous: 
1402160, current: 1402155; changing to 1402161. This may result in 
incorrect timestamps in the output file.
[mpegts @ 0x44a8d20] Non-monotonous DTS in output stream 0:3; previous: 
1520926, current: 1520923; changing to 1520927. This may result in 
incorrect timestamps in the output file.
[mpegts @ 0x44a8d20] Non-monotonous DTS in output stream 0:8; previous: 
1790744, current: 1790742; changing to 1790745. This may result in 
incorrect timestamps in the output file.
[mpegts @ 0x44a8d20] Non-monotonous DTS in output stream 0:4; previous: 
2600222, current: 2600213; changing to 2600223. This may result in 
incorrect timestamps in the output file.
frame=  725 fps= 25 q=-1.0 Lsize=   10221kB time=00:00:29.99 
bitrate=2791.1kbits/s speed=1.03x
video:6659kB audio:2626kB subtitle:0kB other streams:0kB global 
headers:0kB muxing overhead: 10.079859%




More information about the ffmpeg-user mailing list