FFMPEG rtsp skips frames while transcribing to m3u8/ts file

Viewed 287

The result is always the same or similar, it starts rendering using this command

ffmpeg -strict 1 -rtsp_transport "tcp" -i rtsp://123456:2525 -y -profile baseline -movflags +faststart -hls_time 5 -hls_allow_cache 0 -hls_flags delete_segments -start_number 1 -an "/stream/some_m3_file.m3u8" >& m3LogFile.txt &

And its usually the same, first video flawless and great, the second comes in with some spikes and then eventually spikes up to 2 seconds of frame skips, hare is a gif of the time only, so its clear how its behaving

https://i.gyazo.com/8a04934bc73fa216846eb57696b8329a.mp4

Hare is fraction of the log output (The process looks okay):

  Metadata:
title           : Nvt RTSP, streamed by the LIVE555 Media Server
comment         : 00000002
encoder         : Lavf58.29.100
Stream #0:0: Video: h264 (libx264), yuvj420p(pc), 848x480, q=-1--1, 30 fps, 90k tbn, 30 tbc
Metadata:
  encoder         : Lavc58.54.100 libx264
Side data:
  cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame=   33 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A dup=22 drop=12 speed=   0x    
frame=   49 fps= 44 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A dup=25 drop=12 speed=   0x    
frame=   56 fps= 34 q=29.0 size=N/A time=00:00:00.10 bitrate=N/A dup=26 drop=12 speed=0.0606x    
frame=   69 fps= 29 q=29.0 size=N/A time=00:00:00.53 bitrate=N/A dup=28 drop=12 speed=0.223x    
frame=   86 fps= 26 q=29.0 size=N/A time=00:00:01.10 bitrate=N/A dup=31 drop=12 speed=0.336x    
frame=  103 fps= 25 q=29.0 size=N/A time=00:00:01.66 bitrate=N/A dup=32 drop=12 speed=0.401x    
frame=  120 fps= 26 q=29.0 size=N/A time=00:00:02.23 bitrate=N/A dup=35 drop=12 speed=0.479x    
frame=  123 fps= 24 q=29.0 size=N/A time=00:00:02.33 bitrate=N/A dup=35 drop=12 speed=0.451x    
frame=  139 fps= 23 q=29.0 size=N/A time=00:00:02.86 bitrate=N/A dup=38 drop=12 speed=0.483x    
frame=  155 fps= 24 q=29.0 size=N/A time=00:00:03.40 bitrate=N/A dup=41 drop=12 speed=0.527x    
frame=  162 fps= 23 q=29.0 size=N/A time=00:00:03.63 bitrate=N/A dup=42 drop=12 speed=0.52x    
frame=  175 fps= 23 q=29.0 size=N/A time=00:00:04.06 bitrate=N/A dup=44 drop=12 speed=0.53x    
frame=  191 fps= 23 q=29.0 size=N/A time=00:00:04.60 bitrate=N/A dup=47 drop=12 speed=0.561x    
frame=  197 fps= 23 q=29.0 size=N/A time=00:00:04.80 bitrate=N/A dup=48 drop=12 speed=0.55x    
frame=  211 fps= 22 q=29.0 size=N/A time=00:00:05.26 bitrate=N/A dup=50 drop=12 speed=0.557x    
frame=  227 fps= 23 q=29.0 size=N/A time=00:00:05.80 bitrate=N/A dup=53 drop=12 speed=0.582x    
frame=  234 fps= 22 q=29.0 size=N/A time=00:00:06.03 bitrate=N/A dup=54 drop=12 speed=0.574x    
frame=  247 fps= 22 q=29.0 size=N/A time=00:00:06.46 bitrate=N/A dup=56 drop=12 speed=0.578x    
frame=  262 fps= 22 q=29.0 size=N/A time=00:00:06.96 bitrate=N/A dup=59 drop=12 speed=0.594x    
frame=  266 fps= 22 q=29.0 size=N/A time=00:00:07.10 bitrate=N/A dup=59 drop=12 speed=0.581x    
frame=  282 fps= 22 q=29.0 size=N/A time=00:00:07.63 bitrate=N/A dup=62 drop=12 speed=0.597x    
frame=  292 fps= 22 q=29.0 size=N/A time=00:00:07.96 bitrate=N/A dup=64 drop=12 speed=0.598x    
frame=  300 fps= 22 q=29.0 size=N/A time=00:00:08.23 bitrate=N/A dup=65 drop=12 speed=0.593x    
[hls @ 0x55e1d3062a40] Opening '/stream/some_m3_file.m3u8.tmp' for writing
[hls @ 0x55e1d3062a40] Opening '/stream/some_m3_file2.ts' for writing

And so on.. The whole log looks fine, similar, no errors, however at the end I get:

[h264 @ 0x55e1d31473c0] error while decoding MB 10 17, bytestream -8
[h264 @ 0x55e1d31473c0] concealing 728 DC, 728 AC, 728 MV errors in I frame
[hls @ 0x55e1d3062a40] Opening '/stream/some_m3_file.m3u8.tmp' for writing
frame= 5175 fps= 28 q=-1.0 Lsize=N/A time=00:02:52.50 bitrate=N/A dup=2339 drop=12 speed=0.95x    
video:7533kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 0x55e1d3029c00] frame I:21    Avg QP:16.43  size: 29243
[libx264 @ 0x55e1d3029c00] frame P:5154  Avg QP:19.38  size:  1377
[libx264 @ 0x55e1d3029c00] mb I  I16..4: 36.3%  0.0% 63.7%
[libx264 @ 0x55e1d3029c00] mb P  I16..4:  2.7%  0.0%  0.6%  P16..4:  8.6%  1.7%  0.4%  0.0%  0.0%    skip:86.0%
[libx264 @ 0x55e1d3029c00] coded y,uvDC,uvAC intra: 33.4% 38.4% 7.4% inter: 2.0% 6.2% 0.3%
[libx264 @ 0x55e1d3029c00] i16 v,h,dc,p: 20% 15% 15% 50%
[libx264 @ 0x55e1d3029c00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 18% 27%  3%  6%  5%  5%  3%  3%
[libx264 @ 0x55e1d3029c00] i8c dc,h,v,p: 57% 16% 23%  3%
[libx264 @ 0x55e1d3029c00] ref P L0: 82.7%  9.6%  7.7%
[libx264 @ 0x55e1d3029c00] kb/s:357.73

I tried a lot of variations of commands, accidentally lost the history of it, however this is the last command line I've built that was working, but not behaving differently.

ffmpeg -max_delay 1 -strict 1 -initial_pause 0 -rtsp_transport "tcp" -analyzeduration 20M -probesize 20M -i rtsp://123456:2525 -y -s 854x480 -crf 0 -b:v 25K -movflags +faststart -hls_time 5 -hls_allow_cache 0 -hls_flags delete_segments -start_number 1 -an "/stream/some_m3_file.m3u8" >& m3LogFile.txt &

Not sure what's actually going on here, my own speculation is that, the data flow from RTSP is too slow and ffmpeg fast forwards time because its trying to catch up to the current time, but then again, I'd rather make it so it would lag but fully show not skip frames, however I did not find a way to implement it.

0 Answers
Related