Opened 2 years ago

Last modified 18 months ago

#5663 open defect

cannot transcode flv (cannot find video stream)

Reported by: orz- Owned by:
Priority: minor Component: avformat
Version: git-master Keywords: flv
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
I am trying to transcode from streaming captured flv(avc+aac) video to mp4(avc+aac) format,
with original Latest Zeranoe FFmpeg Build Version: 6935aaa (2016-06-24)(windows binary of https://ffmpeg.zeranoe.com/builds/) , but cannot find video stream ,instead found subtitle stream.
Our(Saccubus team) modified ffmpeg (http://ci.ledyba.org/job/SaccubusFFmpegBuild_1.x/lastSuccessfulBuild/artifact/ffmpeg_1.x_20160624_075650.7z) does the same.
The sample flv file may be broken nevertheless it can be viewed by MPC-HC x64 Windows application (verison and property info is mpchc64_OK_version.txt)
I am not sure this is bug.

Command line:(on msys2 MinGW-w64 32bit - Windows 10)
How to reproduce:

% "C:\\msys64\\usr\\local\\src\\ffmpeg_bug_report\\0624\\ffmpeg.exe" -y -i sample_flvrepair100.flv -q:v 0 -s 640x360 out.mp4
ffmpeg version N-80615-g6935aaa Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 26.100 / 55. 26.100
  libavcodec     57. 46.100 / 57. 46.100
  libavformat    57. 40.101 / 57. 40.101
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 46.102 /  6. 46.102
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Splitting the commandline.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-i' ... matched as input file with argument 'sample_flvrepair100.flv'.
Reading option '-q:v' ... matched as option 'q' (use fixed quality scale (VBR)) with argument '0'.
Reading option '-s' ... matched as option 's' (set frame size (WxH or abbreviation)) with argument '640x360'.
Reading option 'out.mp4' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file sample_flvrepair100.flv.
Successfully parsed a group of options.
Opening an input file: sample_flvrepair100.flv.
[file @ 03c09500] Setting default whitelist 'file,crypto'
[flv @ 03c08de0] Format flv probed with size=2048 and score=100
[flv @ 03c08de0] Before avformat_find_stream_info() pos: 13 bytes read:32768 seeks:0 nb_streams:0
[flv @ 03c08de0] audio stream discovered after head already parsed
[flv @ 03c08de0] subtitle stream discovered after head already parsed
[flv @ 03c08de0] max_analyze_duration 5000000 reached at 5014000 microseconds st:0
[flv @ 03c08de0] After avformat_find_stream_info() pos: 49702 bytes read:98308 seeks:2 frames:221
Input #0, flv, from 'sample_flvrepair100.flv':
  Metadata:
    moovPosition    : 36
    avcprofile      : 100
    avclevel        : 30
    aacaot          : 2
    videoframerate  : 28
    audiochannels   : 2
    sampletype      : mp4a
    length          : 3984381
    timescale       : 1000
  Duration: 01:06:24.41, start: 2.322000, bitrate: 284 kb/s
    Stream #0:0, 220, 1/1000: Audio: aac, 44100 Hz, stereo, fltp
    Stream #0:1, 1, 1/1000: Subtitle: text
Successfully opened the file.
Parsing a group of options: output file out.mp4.
Applying option q:v (use fixed quality scale (VBR)) with argument 0.
Applying option s (set frame size (WxH or abbreviation)) with argument 640x360.
Successfully parsed a group of options.
Opening an output file: out.mp4.
[file @ 03222b00] Setting default whitelist 'file,crypto'
Successfully opened the file.
detected 8 logical cores
[graph 0 input from stream 0:0 @ 0323fae0] Setting 'time_base' to value '1/44100'
[graph 0 input from stream 0:0 @ 0323fae0] Setting 'sample_rate' to value '44100'
[graph 0 input from stream 0:0 @ 0323fae0] Setting 'sample_fmt' to value 'fltp'
[graph 0 input from stream 0:0 @ 0323fae0] Setting 'channel_layout' to value '0x3'
[graph 0 input from stream 0:0 @ 0323fae0] tb:1/44100 samplefmt:fltp samplerate:44100 chlayout:0x3
[audio format for output stream 0:0 @ 0323fa60] Setting 'sample_fmts' to value 'fltp'
[audio format for output stream 0:0 @ 0323fa60] Setting 'sample_rates' to value '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
[AVFilterGraph @ 032375e0] query_formats: 4 queried, 9 merged, 0 already done, 0 delayed
[mp4 @ 03233a20] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, mp4, to 'out.mp4':
  Metadata:
    moovPosition    : 36
    avcprofile      : 100
    avclevel        : 30
    aacaot          : 2
    videoframerate  : 28
    audiochannels   : 2
    sampletype      : mp4a
    length          : 3984381
    timescale       : 1000
    encoder         : Lavf57.40.101
    Stream #0:0, 0, 1/44100: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc57.46.100 aac
Stream mapping:
  Stream #0:0 -> #0:0 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[flv @ 03c08de0] video stream discovered after head already parsed
[NULL @ 03206ac0] nal_unit_type: 7, nal_ref_idc: 3
[NULL @ 03206ac0] nal_unit_type: 8, nal_ref_idc: 3
[flv @ 03c08de0] New (null) stream 0:2 at pos:60653 and DTS:8.627s
size=     191kB time=00:00:12.19 bitrate= 128.5kbits/s speed=24.3x    
size=     405kB time=00:00:25.79 bitrate= 128.6kbits/s speed=25.8x    
                                   (*snip*)                                  
size=   56205kB time=00:59:09.23 bitrate= 129.7kbits/s speed=23.5x    
[aac @ 03230da0] decode_band_types: Input buffer exhausted before END element found
Error while decoding stream #0:0: Invalid data found when processing input
[output stream 0:0 @ 0323fbe0] EOF on sink link output stream 0:0:default.
No more output streams to write to, finishing.
size=   56998kB time=00:59:21.33 bitrate= 131.1kbits/s speed=23.5x    
video:0kB audio:56397kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.065180%
Input file #0 (sample_flvrepair100.flv):
  Input stream #0:0 (audio): 153375 packets read (40624776 bytes); 153374 frames decoded (157054976 samples); 
  Input stream #0:1 (subtitle): 1 packets read (515 bytes); 
  Total: 153376 packets (40625291 bytes) demuxed
Output file #0 (out.mp4):
  Output stream #0:0 (audio): 153374 frames encoded (157054976 samples); 153375 packets muxed (57750330 bytes); 
  Total: 153375 packets (57750330 bytes) muxed
153374 frames successfully decoded, 1 decoding errors
[AVIOContext @ 03c004e0] Statistics: 30 seeks, 153416 writeouts
[aac @ 0323bae0] Qavg: 2100.247
[AVIOContext @ 03208080] Statistics: 141830040 bytes read, 2 seeks

sample is https://www.datafilehost.com/d/3abf78e9

Attachments (2)

original_broken_cut.flv (2.4 MB) - added by cehoyos 2 years ago.
sample_flvrepair100_cut.flv (2.4 MB) - added by cehoyos 2 years ago.

Change History (4)

Changed 2 years ago by cehoyos

Changed 2 years ago by cehoyos

comment:1 Changed 2 years ago by cehoyos

  • Component changed from undetermined to avformat
  • Priority changed from normal to minor
  • Status changed from new to open
  • Version changed from unspecified to git-master

Workaround is to specify -analyzeduration 10M.

comment:2 Changed 18 months ago by w3sip

Seeing this problem as well with one of the cameras. Seem to have to do with the newly introduced validation in flv_read_packet: if broken_sizes is set to 1, streams work -- however they seem to be only set to 1 in two very particular cases, which likely are not covering a large variety of broken FLV endpoints.

Note: See TracTickets for help on using tickets.