[FFmpeg-user] Different behaviour decoding with ffplay or ffmpeg

David Cassany Viladomat david.cassany at i2cat.net
Thu Mar 7 15:32:38 CET 2013


Hi all,

I noticed a different behaviour using ffplay to play an IP camera stream or
ffmpeg to grab the camera stream to file.

Basically while using ffplay everything works as expected when using ffmpeg
to decode and encode to file it doesn't behave properly, it always suffer a
terrible packets loss. So the encoded file I get is not a fluid video at
all, plenty of stops and likeif I frames were missing. Here are the
commands and console output I get in both cases:

with ffplay

david at i2cat-david:~/hlstests$ ffplay rtsp://
192.168.10.59/axis-media/media.amp -loglevel debug
ffplay version 1.1.3 Copyright (c) 2003-2013 the FFmpeg developers
  built on Feb 27 2013 16:47:57 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libass --enable-libfaac
--enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libspeex --enable-librtmp
--enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab
--enable-libx264 --enable-nonfree --enable-version3
--enable-decoder=pcm_alaw --enable-decoder=pcm_mulaw
  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 86.100 / 54. 86.100
  libavformat    54. 59.106 / 54. 59.106
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.100 /  3. 32.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[rtsp @ 0xb1201980] SDP:
v=0
o=- 1362665901103598 1362665901103598 IN IP4 192.168.10.59
s=Media Presentation
e=NONE
c=IN IP4 0.0.0.0
b=AS:50000
t=0 0
a=control:*
a=range:npt=0.000000-
m=video 0 RTP/AVP 96
b=AS:50000
a=framerate:30.0
a=control:trackID=1
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; profile-level-id=420029;
sprop-parameter-sets=Z0IAKeKQCgC3YC3AQEBpB4kRUA==,aM48gA==

[rtsp @ 0xb1201980] video codec set to: h264
[NULL @ 0xb12005e0] RTP Packetization Mode: 1
[NULL @ 0xb12005e0] RTP Profile IDC: 42 Profile IOP: 0 Level: 29
[NULL @ 0xb12005e0] Extradata set to 0xb12004e0 (size: 31)!
[rtsp @ 0xb1201980] hello state=0
[rtsp @ 0xb1201980] All info found
rfps: 29.333333 0.017499
rfps: 29.416667 0.013521
rfps: 29.500000 0.010055
rfps: 29.583333 0.007101
    Last message repeated 1 times
rfps: 29.666667 0.004660
    Last message repeated 1 times
rfps: 29.750000 0.002731
    Last message repeated 1 times
rfps: 29.833333 0.001314
    Last message repeated 1 times
rfps: 29.916667 0.000410
    Last message repeated 1 times
rfps: 30.000000 0.000018
rfps: 30.083333 0.000139
    Last message repeated 1 times
rfps: 30.166667 0.000771
    Last message repeated 1 times
rfps: 30.250000 0.001917
    Last message repeated 1 times
rfps: 30.333333 0.003574
    Last message repeated 1 times
rfps: 30.416667 0.005744
    Last message repeated 1 times
rfps: 30.500000 0.008426
rfps: 30.583333 0.011621
rfps: 30.666667 0.015328
rfps: 30.750000 0.019548
rfps: 59.333333 0.018639
rfps: 59.416667 0.014525
rfps: 59.500000 0.010923
rfps: 59.583333 0.007834
    Last message repeated 1 times
rfps: 59.666667 0.005257
    Last message repeated 1 times
rfps: 59.750000 0.003192
    Last message repeated 1 times
rfps: 59.833333 0.001640
    Last message repeated 1 times
rfps: 59.916667 0.000600
    Last message repeated 1 times
rfps: 60.000000 0.000072
rfps: 29.970030 0.000100
    Last message repeated 1 times
rfps: 59.940060 0.000400
    Last message repeated 1 times
[rtsp @ 0xb1201980] Estimating duration from bitrate, this may be inaccurate
Input #0, rtsp, from 'rtsp://192.168.10.59/axis-media/media.amp':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.317300, bitrate: N/A
    Stream #0:0, 28, 1/90000: Video: h264 (Baseline), yuvj420p, 1280x720
[SAR 1:1 DAR 16:9], 1/180000, 30 tbr, 90k tbn, 180k tbc
[h264 @ 0xb12005e0] detected 8 logical cores
[h264 @ 0xb12e77c0] Using externally provided dimensions
Frame changed from size:0x0 to size:1280x720aq=    0KB vq=  299KB sq=    0B
f=0/0
[buffer @ 0xae0f7f00] Setting entry with key 'video_size' to value
'1280x720'
[buffer @ 0xae0f7f00] Setting entry with key 'pix_fmt' to value '12'
[buffer @ 0xae0f7f00] Setting entry with key 'time_base' to value '1/90000'
[buffer @ 0xae0f7f00] Setting entry with key 'pixel_aspect' to value '1/1'
[ffplay_buffer @ 0xae0f7e40] w:1280 h:720 pixfmt:yuvj420p tb:1/90000 fr:0/1
sar:1/1 sws_param:
[crop @ 0xacb98ba0] Setting 'w' to value 'floor(in_w/2)*2'
[crop @ 0xacb98ba0] Setting 'h' to value 'floor(in_h/2)*2'
[scale @ 0xad8f5e20] Setting 'w' to value '0'
[scale @ 0xad8f5e20] Setting 'h' to value '0'
[scale @ 0xad8f5e20] Setting 'flags' to value '4'
[auto-inserted scaler 0 @ 0xad2eaec0] w:0 h:0 flags:'4' interl:0
[ffplay_crop @ 0xacb98ae0] auto-inserting filter 'auto-inserted scaler 0'
between the filter 'ffplay_buffer' and the filter 'ffplay_crop'
[auto-inserted scaler 0 @ 0xad2eaec0] w:1280 h:720 fmt:yuvj420p sar:1/1 ->
w:1280 h:720 fmt:yuv420p sar:1/1 flags:0x4


with ffmpeg

ffmpeg -re -analyzeduration 10 -i
rtsp://192.168.10.59/axis-media/media.amp-ac 2 -b:a 64k -vcodec
libx264 -acodec copy -f mp4 prova.mp4 -loglevel
verbose
ffmpeg version 1.1.3 Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb 27 2013 16:47:57 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libass --enable-libfaac
--enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libspeex --enable-librtmp
--enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab
--enable-libx264 --enable-nonfree --enable-version3
--enable-decoder=pcm_alaw --enable-decoder=pcm_mulaw
  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 86.100 / 54. 86.100
  libavformat    54. 59.106 / 54. 59.106
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.100 /  3. 32.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[rtsp @ 0xae98080] SDP:
v=0

o=- 1362666385646110 1362666385646110 IN IP4
192.168.10.59

s=Media
Presentation

e=NONE

c=IN IP4
0.0.0.0

b=AS:50000

t=0
0

a=control:*

a=range:npt=0.000000-

m=video 0 RTP/AVP
96

b=AS:50000

a=framerate:30.0

a=control:trackID=1

a=rtpmap:96
H264/90000

a=fmtp:96 packetization-mode=1; profile-level-id=420029;
sprop-parameter-sets=Z0IAKeKQCgC3YC3AQEBpB4kRUA==,aM48gA==


[rtsp @ 0xae98080] Estimating duration from bitrate, this may be inaccurate
Input #0, rtsp, from 'rtsp://192.168.10.59/axis-media/media.amp':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.468011, bitrate: N/A
    Stream #0:0: Video: h264 (Baseline), yuvj420p, 1280x720 [SAR 1:1 DAR
16:9], 30 tbr, 90k tbn, 180k tbc
[graph 0 input from stream 0:0 @ 0xaec6480] w:1280 h:720 pixfmt:yuvj420p
tb:1/90000 fr:30/1 sar:1/1 sws_param:flags=2
[libx264 @ 0xb1d9840] using SAR=1/1
[libx264 @ 0xb1d9840] using cpu capabilities: MMX2 SSE2Fast SSSE3
FastShuffle SSE4.2 AVX
[libx264 @ 0xb1d9840] profile High, level 3.1
[libx264 @ 0xb1d9840] 264 - core 129 r22 e403db4 - H.264/MPEG-4 AVC codec -
Copyleft 2003-2013 - 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=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0
qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'prova.mp4':
  Metadata:
    title           : Media Presentation
    encoder         : Lavf54.59.106
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuvj420p, 1280x720
[SAR 1:1 DAR 16:9], q=-1--1, 15360 tbn, 30 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx264)
Press [q] to stop, [?] for help
*** 1 dup!9 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A
[h264 @ 0xaea01e0] RTP: missed 234 packets
[h264 @ 0xc1fd3c0] concealing 2623 DC, 2623 AC, 2623 MV errors in P frame
RTP: missed 231 packets.0 size=       0kB time=00:00:00.00 bitrate=N/A
dup=1 drop=0
[h264 @ 0xc09caa0] concealing 1475 DC, 1475 AC, 1475 MV errors in P frame
[h264 @ 0xaea01e0] RTP: missed 3 packets
[h264 @ 0xc0e1740] concealing 1516 DC, 1516 AC, 1516 MV errors in P frame
*** 25 dup! fps= 11 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A
dup=1 drop=0
[h264 @ 0xaea01e0] RTP: missed 236 packets
[h264 @ 0xc2ba720] concealing 2802 DC, 2802 AC, 2802 MV errors in P frame
[h264 @ 0xaea01e0] RTP: missed 3 packets
[h264 @ 0xc319100] concealing 1577 DC, 1577 AC, 1577 MV errors in P frame
RTP: missed 122 packets9.0 size=     139kB time=00:00:00.16
bitrate=6822.9kbits/s dup=26 drop=0
[h264 @ 0xc09caa0] concealing 473 DC, 473 AC, 473 MV errors in I frame
*** 25 dup!
RTP: missed 253 packets9.0 size=     439kB time=00:00:01.06
bitrate=3370.9kbits/s dup=51 drop=0
[h264 @ 0xc1400c0] concealing 585 DC, 585 AC, 585 MV errors in P frame
[h264 @ 0xaea01e0] RTP: missed 181 packets
[h264 @ 0xc25bd40] concealing 496 DC, 496 AC, 496 MV errors in I frame
*** 25 dup! fps= 19 q=29.0 size=     444kB time=00:00:01.20
bitrate=3032.1kbits/s dup=51 drop=0
[h264 @ 0xaea01e0] RTP: missed 178 packets
concealing 956 DC, 956 AC, 956 MV errors in P frame00:02.10
bitrate=2165.5kbits/s dup=76 drop=0
*** 8 dup!
[h264 @ 0xaea01e0] RTP: missed 308 packets
[h264 @ 0xc1400c0] concealing 1284 DC, 1284 AC, 1284 MV errors in P frame
*** 17 dup!
RTP: missed 60 packets29.0 size=     690kB time=00:00:03.10
bitrate=1824.3kbits/s dup=101 drop=0
[h264 @ 0xc1fd3c0] concealing 851 DC, 851 AC, 851 MV errors in P frame
[h264 @ 0xaea01e0] RTP: missed 13 packets
[h264 @ 0xc25bd40] concealing 283 DC, 283 AC, 283 MV errors in P frame
*** 12 dup!
RTP: missed 93 packets29.0 size=     696kB time=00:00:03.60
bitrate=1584.3kbits/s dup=113 drop=0
[h264 @ 0xc377ae0] concealing 3170 DC, 3170 AC, 3170 MV errors in P frame
*** 14 dup!
[h264 @ 0xaea01e0] RTP: missed 190 packets
[h264 @ 0xc09caa0] concealing 2385 DC, 2385 AC, 2385 MV errors in P frame
frame=  183 fps= 22 q=29.0 Lsize=    1060kB time=00:00:06.03
bitrate=1439.8kbits/s dup=127 drop=0
video:1057kB audio:0kB subtitle:0 global headers:0kB muxing overhead
0.277332%
[libx264 @ 0xb1d9840] frame I:3     Avg QP:21.80  size: 47003
[libx264 @ 0xb1d9840] frame P:57    Avg QP:21.51  size: 14764
[libx264 @ 0xb1d9840] frame B:123   Avg QP:32.18  size:   809
[libx264 @ 0xb1d9840] consecutive B-frames:  7.1%  7.7%  6.6% 78.7%
[libx264 @ 0xb1d9840] mb I  I16..4: 19.9% 52.6% 27.5%
[libx264 @ 0xb1d9840] mb P  I16..4:  3.0%  6.3%  2.1%  P16..4: 21.4%  5.2%
2.8%  0.0%  0.0%    skip:59.2%
[libx264 @ 0xb1d9840] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8: 12.5%  0.4%
0.1%  direct: 0.3%  skip:86.6%  L0:40.2% L1:58.8% BI: 1.0%
[libx264 @ 0xb1d9840] 8x8 transform intra:53.8% inter:44.2%
[libx264 @ 0xb1d9840] coded y,uvDC,uvAC intra: 52.9% 26.1% 11.2% inter:
5.9% 4.0% 0.4%
[libx264 @ 0xb1d9840] i16 v,h,dc,p: 27% 46%  9% 18%
[libx264 @ 0xb1d9840] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 29% 18%  2%  4%
4%  7%  5%  4%
[libx264 @ 0xb1d9840] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 25% 13%  5%  5%
5%  6%  6%  5%
[libx264 @ 0xb1d9840] i8c dc,h,v,p: 56% 23% 19%  1%
[libx264 @ 0xb1d9840] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0xb1d9840] ref P L0: 66.6% 11.7% 17.7%  4.0%
[libx264 @ 0xb1d9840] ref B L0: 76.4% 20.5%  3.1%
[libx264 @ 0xb1d9840] ref B L1: 85.2% 14.8%
[libx264 @ 0xb1d9840] kb/s:1419.13
Received signal 2: terminating.


There is anyone who can give me a hint on how to deal with this issue? I
guess ffplay and ffmpeg use the same libraries internally and that the
reception code should be the same. So that it suprises me this two
different behaviours.


Thanks in advance.  Best regards,
David


More information about the ffmpeg-user mailing list