> On May 31, 2018, at 12:40, Steven Liu <l...@chinaffmpeg.org> wrote: > > dump the problem flv to problem_flv.flv. > liuqideMacBook-Pro:xxx liuqi$ dd if=~/Movies/Test/1.flv of=problem_flv.flv > count=81920 bs=1 > 81920+0 records in > 81920+0 records out > 81920 bytes transferred in 0.767041 secs (106800 bytes/sec) > > before this patch: > liuqideMacBook-Pro:xxx liuqi$ ./ffplay problem_flv.flv > ffplay version N-91141-gc24d247e2c Copyright (c) 2003-2018 the FFmpeg > developers > built with Apple LLVM version 9.1.0 (clang-902.0.39.1) > configuration: --enable-fontconfig --enable-gpl --enable-libass > --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libspeex > --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-version3 > --cc='ccache gcc' --enable-nonfree --enable-videotoolbox --enable-opengl > --enable-libxml2 --enable-libsrt > libavutil 56. 18.102 / 56. 18.102 > libavcodec 58. 19.102 / 58. 19.102 > libavformat 58. 16.100 / 58. 16.100 > libavdevice 58. 4.100 / 58. 4.100 > libavfilter 7. 24.100 / 7. 24.100 > libswscale 5. 2.100 / 5. 2.100 > libswresample 3. 2.100 / 3. 2.100 > libpostproc 55. 2.100 / 55. 2.100 > [flv @ 0x7fcfe5821e00] Packet mismatch 355 352 352 > problem_flv.flv: could not find codec parameters > > after this patch: > liuqideMacBook-Pro:xxx liuqi$ ./ffplay -flv_ignore_prevtag 1 problem_flv.flv > ffplay version N-91141-gc24d247e2c Copyright (c) 2003-2018 the FFmpeg > developers > built with Apple LLVM version 9.1.0 (clang-902.0.39.1) > configuration: --enable-fontconfig --enable-gpl --enable-libass > --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libspeex > --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-version3 > --cc='ccache gcc' --enable-nonfree --enable-videotoolbox --enable-opengl > --enable-libxml2 --enable-libsrt > libavutil 56. 18.102 / 56. 18.102 > libavcodec 58. 19.102 / 58. 19.102 > libavformat 58. 16.100 / 58. 16.100 > libavdevice 58. 4.100 / 58. 4.100 > libavfilter 7. 24.100 / 7. 24.100 > libswscale 5. 2.100 / 5. 2.100 > libswresample 3. 2.100 / 3. 2.100 > libpostproc 55. 2.100 / 55. 2.100 > Input #0, flv, from 'problem_flv.flv': > Metadata: > fileSize : 102128061 > audiochannels : 2 > encoder : obs-output module (libobs version 0.10.1) > Duration: 00:05:09.60, start: 0.000000, bitrate: 2 kb/s > Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 131 kb/s > Stream #0:1: Video: h264 (High), yuv420p(tv, bt709, progressive), 960x600, > 2560 kb/s, 30 fps, 30 tbr, 1k tbn, 60 tbc > [h264 @ 0x7fdf64122a00] Invalid NAL unit size (10375 > 1656).=0/0 > [h264 @ 0x7fdf64122a00] Error splitting the input into NAL units. > 2.14 A-V: -0.013 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0 > > Signed-off-by: Steven Liu <l...@chinaffmpeg.org> > --- > doc/demuxers.texi | 3 +++ > libavformat/flvdec.c | 4 ++++ > 2 files changed, 7 insertions(+) > > diff --git a/doc/demuxers.texi b/doc/demuxers.texi > index 072918be28..5007e6339f 100644 > --- a/doc/demuxers.texi > +++ b/doc/demuxers.texi > @@ -269,6 +269,9 @@ ffmpeg -f live_flv -i rtmp://<any.server>/anything/key > .... > @table @option > @item -flv_metadata @var{bool} > Allocate the streams according to the onMetaData array content. > + > +@item -flv_ignore_prevtag @var{bool} > +Ignore the size of previous tag value. > @end table > > @section gif > diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c > index 34c3e08bad..861cf7c020 100644 > --- a/libavformat/flvdec.c > +++ b/libavformat/flvdec.c > @@ -44,6 +44,7 @@ > typedef struct FLVContext { > const AVClass *class; ///< Class for private options. > int trust_metadata; ///< configure streams according onMetaData > + int trust_datasize; ///< trust data size of FLVTag > int wrong_dts; ///< wrong dts due to negative cts > uint8_t *new_extradata[FLV_STREAM_TYPE_NB]; > int new_extradata_size[FLV_STREAM_TYPE_NB]; > @@ -1252,6 +1253,7 @@ retry_duration: > > leave: > last = avio_rb32(s->pb); > + if (!flv->trust_datasize) { > if (last != orig_size + 11 && last != orig_size + 10 && > !avio_feof(s->pb) && > (last != orig_size || !last) && last != flv->sum_flv_tag_size && > @@ -1264,6 +1266,7 @@ leave: > goto retry; > } > } > + } > return ret; > } > > @@ -1279,6 +1282,7 @@ static int flv_read_seek(AVFormatContext *s, int > stream_index, > #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM > static const AVOption options[] = { > { "flv_metadata", "Allocate streams according to the onMetaData array", > OFFSET(trust_metadata), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VD }, > + { "flv_ignore_prevtag", "Ignore the Size of previous tag", > OFFSET(trust_datasize), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VD }, > { "missing_streams", "", OFFSET(missing_streams), AV_OPT_TYPE_INT, { .i64 > = 0 }, 0, 0xFF, VD | AV_OPT_FLAG_EXPORT | AV_OPT_FLAG_READONLY }, > { NULL } > }; > -- > 2.15.1 >
Thanks Steven sample file:
problem_flv.flv
Description: video/flv
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel