[FFmpeg-user] capture mpeg2 from dvdlast

Micael Silva micaelsilva at gmail.com
Fri Nov 23 02:21:11 EET 2018


On Thu, 22 Nov 2018, 14:37 Javier Fuentes, <jfuentes at flumotion.com> wrote:

> Hello Everybody
>
>
> I have this ffmpeg command
> ffmpeg -i rtp://127.0.0.1:6000 -map 0:4 -map 0:2 -vcodec libx264 -b:v
> 1500k
> -s 720x576 -acodec aac  -ab 128k -ac 2 -ar 48000 -r 25 -f flv
> rtmp://encoder....
>
> I have a lot of errors when i start capture a mpeg2 signal, and after a
> while the capture starts to fail
>
> Thanks a lot for your help
> Best regards
>
> My log
> ffmpeg version git-2018-11-12-ae43235 Copyright (c) 2000-2018 the FFmpeg
> developers
>   built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-28)
>   configuration: --prefix=/root/ffmpeg_build
> --extra-cflags=-I/root/ffmpeg_build/include
> --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin
> --extra-libs=-ldl --enable-gpl --enable-nonfree --enable-libfdk_aac
> --enable-libmp3lame --enable-libvpx --enable-libx264 --enable-libfreetype
> --enable-libspeex --enable-libtheora --enable-libass --enable-avfilter
> --enable-pthreads --enable-decoder=mpeg4 --enable-decoder=mpegvideo
> --enable-parser=mpeg4video --enable-parser=mpegvideo
> --enable-muxer=mpeg2video --enable-muxer=mp4 --enable-muxer=h264
> --enable-demuxer=h264 --enable-parser=ac3 --enable-parser=h261
> --enable-parser=vc1 --enable-decoder=aac --enable-parser=aac
> --enable-demuxer=aac --enable-demuxer=vc1 --enable-decoder=h264
> --enable-parser=h264 --enable-demuxer=h264 --enable-muxer=h264
>   libavutil      56. 23.101 / 56. 23.101
>   libavcodec     58. 39.100 / 58. 39.100
>   libavformat    58. 22.100 / 58. 22.100
>   libavdevice    58.  6.100 / 58.  6.100
>   libavfilter     7. 43.100 /  7. 43.100
>   libswscale      5.  4.100 /  5.  4.100
>   libswresample   3.  4.100 /  3.  4.100
>   libpostproc    55.  4.100 / 55.  4.100
> [mpeg2video @ 0x2befc40] Invalid frame dimensions 0x0.
>     Last message repeated 13 times
> Input #0, rtp, from 'rtp://127.0.0.1:6000':
>   Duration: N/A, start: 51639.509822, bitrate: N/A
>   Program 493
>     Metadata:
>       service_name    : Clan
>       service_provider: RTVE
>     Stream #0:4: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002),
> yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k
> tbn, 50 tbc
>     Stream #0:0(spa,spa,qaa): Subtitle: dvb_teletext ([6][0][0][0] /
> 0x0006)
>     Stream #0:1(spa): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo,
> s16p, 128 kb/s
>     Stream #0:3(qaa): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo,
> s16p, 128 kb/s
>     Stream #0:2(spa): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, mono,
> s16p, 96 kb/s (visual impaired) (descriptions)
>     Stream #0:5(spa): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
>     Stream #0:6(qaa): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
> Stream mapping:
>   Stream #0:4 -> #0:0 (mpeg2video (native) -> h264 (libx264))
>   Stream #0:2 -> #0:1 (mp2 (native) -> aac (native))
> Press [q] to stop, [?] for help
> [libx264 @ 0x2c50340] using SAR=64/45
> [libx264 @ 0x2c50340] using cpu capabilities: none!
> [libx264 @ 0x2c50340] profile High, level 3.0, 4:2:0, 8-bit
> [libx264 @ 0x2c50340] 264 - core 157 - H.264/MPEG-4 AVC codec - Copyleft
> 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3
> deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
> mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11
> fast_pskip=1 chroma_qp_offset=-2 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=1 b_bias=0 direct=1
> weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40
> intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=1500 ratetol=1.0
> qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
> Output #0, flv, to 'rtmp://
> encoder-cg10.bt.bcn.flumotion.net:1935/yuvod/clan
> ':
>   Metadata:
>     encoder         : Lavf58.22.100
>     Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p,
> 720x576 [SAR 64:45 DAR 16:9], q=-1--1, 1500 kb/s, 25 fps, 1k tbn, 25 tbc
>     Metadata:
>       encoder         : Lavc58.39.100 libx264
>     Side data:
>       cpb: bitrate max/min/avg: 0/0/1500000 buffer size: 0 vbv_delay: -1
>     Stream #0:1(spa): Audio: aac (LC) ([10][0][0][0] / 0x000A), 48000 Hz,
> stereo, fltp, 128 kb/s (visual impaired) (descriptions)
>     Metadata:
>       encoder         : Lavc58.39.100 aac
> [rtp @ 0x2b9ab40] max delay reached. need to consume packet
> bitrate=1458.5kbits/s speed=1.02x
> [rtp @ 0x2b9ab40] RTP: missed 13 packets
> [rtp @ 0x2b9ab40] PES packet size mismatch
> [mpeg2video @ 0x2c53180] ac-tex damaged at 43 26
> [mpeg2video @ 0x2c53180] Warning MVs not available
> [mpeg2video @ 0x2c53180] concealing 270 DC, 270 AC, 270 MV errors in I
> frame
> [mpeg2video @ 0x2c53180] slice mismatch
> [mpeg2video @ 0x2c53180] Warning MVs not available
> [mpeg2video @ 0x2c53180] concealing 180 DC, 180 AC, 180 MV errors in P
> frame
> [mpeg2video @ 0x2c53180] Warning MVs not available
> [mpeg2video @ 0x2c53180] concealing 689 DC, 689 AC, 689 MV errors in B
> frame
> [mpeg2video @ 0x2c53180] Warning MVs not available
> [mpeg2video @ 0x2c53180] concealing 418 DC, 418 AC, 418 MV errors in P
> frame
> [mpeg2video @ 0x2c53180] mb incr damaged
> [mpeg2video @ 0x2c53180] Warning MVs not available
> [mpeg2video @ 0x2c53180] concealing 540 DC, 540 AC, 540 MV errors in B
> frame
> [mp2 @ 0x2c512c0] Header missing
> Error while decoding stream #0:2: Invalid data found when processing input
> [mpeg2video @ 0x2c53180] 00 motion_type at 16 9
> [mpeg2video @ 0x2c53180] Warning MVs not available
> [mpeg2video @ 0x2c53180] concealing 675 DC, 675 AC, 675 MV errors in P
> frame
> [mpeg2video @ 0x2c53180] Warning MVs not available
> [mpeg2video @ 0x2c53180] concealing 638 DC, 638 AC, 638 MV errors in B
> frame
> [rtp @ 0x2b9ab40] max delay reached. need to consume packet
> bitrate=1505.9kbits/s speed=1.02x
> [rtp @ 0x2b9ab40] RTP: missed 3 packets
> [mpeg2video @ 0x2c53180] Invalid mb type in I-frame at 17 28
> [mpeg2video @ 0x2c53180] ac-tex damaged at 12 31
> [mpeg2video @ 0x2c53180] Warning MVs not available
> [mpeg2video @ 0x2c53180] concealing 135 DC, 135 AC, 135 MV errors in I
> frame
> [mpeg2video @ 0x2c53180] slice mismatch
> [mpeg2video @ 0x2c53180] Warning MVs not available
> [mpeg2video @ 0x2c53180] concealing 945 DC, 945 AC, 945 MV errors in P
> frame
> [mpeg2video @ 0x2c53180] slice mismatch
> [mpeg2video @ 0x2c53180] Warning MVs not available
> [mpeg2video @ 0x2c53180] concealing 360 DC, 360 AC, 360 MV errors in B
> frame
> [mpeg2video @ 0x2c53180] 00 motion_type at 5 15
> [mpeg2video @ 0x2c53180] Warning MVs not available
> [mpeg2video @ 0x2c53180] concealing 360 DC, 360 AC, 360 MV errors in B
> frame
> [mpeg2video @ 0x2c53180] 00 motion_type at 34 11
> [mpeg2video @ 0x2c53180] Warning MVs not available
> [mpeg2video @ 0x2c53180] concealing 540 DC, 540 AC, 540 MV errors in P
> frame
> [mpeg2video @ 0x2c53180] 00 motion_type at 12 16
> [mpeg2video @ 0x2c53180] Warning MVs not available
> [mpeg2video @ 0x2c53180] concealing 450 DC, 450 AC, 450 MV errors in B
> frame
> [rtp @ 0x2b9ab40] PES packet size mismatch
> [mpeg2video @ 0x2c53180] Warning MVs not available
> [mpeg2video @ 0x2c53180] concealing 554 DC, 554 AC, 554 MV errors in B
> frame
> [mp2 @ 0x2c512c0] Header missing    5090kB time=00:00:27.50
> bitrate=1515.7kbits/s speed=1.02x
> Error while decoding stream #0:2: Invalid data found when processing input
> [flv @ 0x2c1bb80] Failed to update header with correct
> duration.ate=1526.9kbits/s speed=1.02x
> [flv @ 0x2c1bb80] Failed to update header with correct filesize.
> frame=  730 fps= 24 q=-1.0 Lsize=    5743kB time=00:00:30.44
> bitrate=1545.4kbits/s speed=1.01x
> video:5435kB audio:270kB subtitle:0kB other streams:0kB global headers:0kB
> muxing overhead: 0.660891%
> [libx264 @ 0x2c50340] frame I:5     Avg QP: 9.75  size: 70585
> [libx264 @ 0x2c50340] frame P:214   Avg QP:12.50  size: 18386
> [libx264 @ 0x2c50340] frame B:511   Avg QP:16.56  size:  2499
> [libx264 @ 0x2c50340] consecutive B-frames:  1.6%  7.7% 22.2% 68.5%
> [libx264 @ 0x2c50340] mb I  I16..4: 30.1% 48.7% 21.2%
> [libx264 @ 0x2c50340] mb P  I16..4:  2.2%  1.5%  1.4%  P16..4: 24.9%  7.6%
> 8.9%  0.0%  0.0%    skip:53.4%
> [libx264 @ 0x2c50340] mb B  I16..4:  0.2%  0.1%  0.1%  B16..8: 20.3%  2.5%
> 0.9%  direct: 2.1%  skip:73.8%  L0:39.8% L1:49.8% BI:10.4%
> [libx264 @ 0x2c50340] final ratefactor: 13.27
> [libx264 @ 0x2c50340] 8x8 transform intra:34.3% inter:71.5%
> [libx264 @ 0x2c50340] coded y,uvDC,uvAC intra: 47.9% 59.6% 50.1% inter:
> 9.5% 12.2% 8.1%
> [libx264 @ 0x2c50340] i16 v,h,dc,p: 55% 41%  4%  0%
> [libx264 @ 0x2c50340] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 24% 34%  2%  2%
> 3%  2%  3%  3%
> [libx264 @ 0x2c50340] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 40% 30% 15%  2%  2%
> 3%  2%  3%  2%
> [libx264 @ 0x2c50340] i8c dc,h,v,p: 32% 32% 33%  3%
> [libx264 @ 0x2c50340] Weighted P-Frames: Y:0.0% UV:0.0%
> [libx264 @ 0x2c50340] ref P L0: 75.2%  6.0% 12.0%  6.8%
> [libx264 @ 0x2c50340] ref B L0: 76.6% 20.3%  3.1%
> [libx264 @ 0x2c50340] ref B L1: 92.4%  7.6%
> [libx264 @ 0x2c50340] kb/s:1524.49
> [aac @ 0x2c50d80] Qavg: 65421.590
> Exiting normally, received signal 2.
> [root at encoder012 bin]# ^C
>
>
> My ffmpeg version and my log
>
> fmpeg version git-2018-11-12-ae43235 Copyright (c) 2000-2018 the FFmpeg
> developers
>   built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-28)
>   configuration: --prefix=/root/ffmpeg_build
> --extra-cflags=-I/root/ffmpeg_build/include
> --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin
> --extra-libs=-ldl --enable-gpl --enable-nonfree --enable-libfdk_aac
> --enable-libmp3lame --enable-libvpx --enable-libx264 --enable-libfreetype
> --enable-libspeex --enable-libtheora --enable-libass --enable-avfilter
> --enable-pthreads --enable-decoder=mpeg4 --enable-decoder=mpegvideo
> --enable-parser=mpeg4video --enable-parser=mpegvideo
> --enable-muxer=mpeg2video --enable-muxer=mp4 --enable-muxer=h264
> --enable-demuxer=h264 --enable-parser=ac3 --enable-parser=h261
> --enable-parser=vc1 --enable-decoder=aac --enable-parser=aac
> --enable-demuxer=aac --enable-demuxer=vc1 --enable-decoder=h264
> --enable-parser=h264 --enable-demuxer=h264 --enable-muxer=h264
>   libavutil      56. 23.101 / 56. 23.101
>   libavcodec     58. 39.100 / 58. 39.100
>   libavformat    58. 22.100 / 58. 22.100
>   libavdevice    58.  6.100 / 58.  6.100
>   libavfilter     7. 43.100 /  7. 43.100
>   libswscale      5.  4.100 /  5.  4.100
>   libswresample   3.  4.100 /  3.  4.100
>   libpostproc    55.  4.100 / 55.  4.100
> Hyper fast Audio and Video encoder
> usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options]
> outfile}...
>
>
>
>
> --
>
>
> Javier Fuentes
> Flumotion Services S.A.
>
> Avda. Diagonal 579-587 7ยบ
> 08021 Barcelona - Spainwww.flumotion.com


Maybe the errors came from the fact that the output tries to encode frames
that depends of I frames that aren't avaliable yet becase it's a live
stream.

Try to record the input side (ffmpeg -i rtp://127.0.0.1:6000 -map 0:4 -map
0:2 -c copy file.mpg) then afterwards feed it to live encode. If went well
you could try the previous command adding -bufsize on encode side to make
it wait until buffer reaches certain level to start encoding frames,
increasing buffer size as required to eliminate error. It works for me to
encode live from DVB tuners.


More information about the ffmpeg-user mailing list