Open ratsputin opened 1 year ago
Here's an example of a debug run with an RTSP stream that has an issue. ffmpeg just streams the following error:
[vost#0:0/rawvideo @ 0xaaaae971d460] cur_dts is invalid [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
Here's the full run.
root@431f1de541b7:/opt/frigate# ffmpeg -loglevel debug -c:v h264_nvmpi -re -rtsp_transport tcp -stream_loop -1 -i rtsp://ha.dante.local:8554/front-yard -f rawvideo -pix_fmt yuv420p pipe: > /dev/null
ffmpeg version 3f345eb Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
configuration: --pkg-config-flags=--static --pkg-config=pkg-config --enable-nonfree --enable-gpl --enable-cuda-nvcc --enable-nvmpi --disable-debug --disable-doc --disable-ffplay --enable-fontconfig --enable-libaom --enable-libaribb24 --enable-libass --enable-libbluray --enable-libfdk_aac --enable-libfreetype --enable-libkvazaar --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libsrt --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxvid --enable-libzmq --enable-openssl --enable-postproc --enable-shared --enable-small --enable-version3 --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib --extra-ldflags=-pthread --extra-ldexeflags=-pie --extra-cflags=-DLIBTWOLAME_STATIC --extra-libs=-ldl --extra-libs=-lpthread --extra-libs=-lgomp --prefix=/opt/ffmpeg
libavutil 58. 2.100 / 58. 2.100
libavcodec 60. 3.100 / 60. 3.100
libavformat 60. 3.100 / 60. 3.100
libavdevice 60. 1.100 / 60. 1.100
libavfilter 9. 3.100 / 9. 3.100
libswscale 7. 1.100 / 7. 1.100
libswresample 4. 10.100 / 4. 10.100
libpostproc 57. 1.100 / 57. 1.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'h264_nvmpi'.
Reading option '-re' ... matched as option 're' (read input at native frame rate; equivalent to -readrate 1) with argument '1'.
Reading option '-rtsp_transport' ... matched as AVOption 'rtsp_transport' with argument 'tcp'.
Reading option '-stream_loop' ... matched as option 'stream_loop' (set number of times input stream shall be looped) with argument '-1'.
Reading option '-i' ... matched as input url with argument 'rtsp://ha.dante.local:8554/front-yard'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'rawvideo'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'yuv420p'.
Reading option 'pipe:' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url rtsp://ha.dante.local:8554/front-yard.
Applying option c:v (codec name) with argument h264_nvmpi.
Applying option re (read input at native frame rate; equivalent to -readrate 1) with argument 1.
Applying option stream_loop (set number of times input stream shall be looped) with argument -1.
Successfully parsed a group of options.
Opening an input file: rtsp://ha.dante.local:8554/front-yard.
[tcp @ 0xaaaae93d3af0] No default whitelist set
[tcp @ 0xaaaae93d3af0] Original list of addresses:
[tcp @ 0xaaaae93d3af0] Address 192.168.1.15 port 8554
[tcp @ 0xaaaae93d3af0] Interleaved list of addresses:
[tcp @ 0xaaaae93d3af0] Address 192.168.1.15 port 8554
[tcp @ 0xaaaae93d3af0] Starting connection attempt to 192.168.1.15 port 8554
[tcp @ 0xaaaae93d3af0] Successfully connected to 192.168.1.15 port 8554
[rtsp @ 0xaaaae93d1130] SDP:
v=0
o=- 1 1 IN IP4 0.0.0.0
s=go2rtc/1.5.0
c=IN IP4 0.0.0.0
t=0 0
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=640033;sprop-parameter-sets=Z2QAM6zoAoAPGQ==,aO48sA==
a=control:trackID=0
m=audio 0 RTP/AVP 97
a=rtpmap:97 MPEG4-GENERIC/16000/1
a=fmtp:97 streamtype=5;profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=1408
a=control:trackID=1
[rtsp @ 0xaaaae93d1130] video codec set to: h264
[rtsp @ 0xaaaae93d1130] RTP Profile IDC: 64 Profile IOP: 0 Level: 33
[rtsp @ 0xaaaae93d1130] Extradata set to 0xaaaae93d73b0 (size: 22)
[rtsp @ 0xaaaae93d1130] audio codec set to: aac
[rtsp @ 0xaaaae93d1130] audio samplerate set to: 16000
[rtsp @ 0xaaaae93d1130] audio channels set to: 1
[rtsp @ 0xaaaae93d1130] setting jitter buffer size to 0
Last message repeated 1 times
[rtsp @ 0xaaaae93d1130] hello state=0
[h264 @ 0xaaaae93d6f00] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0xaaaae93d6f00] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0xaaaae93d6f00] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0xaaaae93d6f00] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0xaaaae93d6f00] nal_unit_type: 5(IDR), nal_ref_idc: 3
[h264 @ 0xaaaae93d6f00] Format yuv420p chosen by get_format().
[h264 @ 0xaaaae93d6f00] Reinit context to 2560x1920, pix_fmt: yuv420p
[h264 @ 0xaaaae93d6f00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
Last message repeated 5 times
[rtsp @ 0xaaaae93d1130] All info found
[rtsp @ 0xaaaae93d1130] rfps: 29.333333 0.019008
[rtsp @ 0xaaaae93d1130] rfps: 29.416667 0.014863
[rtsp @ 0xaaaae93d1130] rfps: 29.500000 0.011231
Last message repeated 1 times
[rtsp @ 0xaaaae93d1130] rfps: 29.583333 0.008109
Last message repeated 1 times
[rtsp @ 0xaaaae93d1130] rfps: 29.666667 0.005499
Last message repeated 1 times
[rtsp @ 0xaaaae93d1130] rfps: 29.750000 0.003400
Last message repeated 1 times
[rtsp @ 0xaaaae93d1130] rfps: 29.833333 0.001813
Last message repeated 1 times
[rtsp @ 0xaaaae93d1130] rfps: 29.916667 0.000737
Last message repeated 1 times
[rtsp @ 0xaaaae93d1130] rfps: 30.000000 0.000173
[rtsp @ 0xaaaae93d1130] rfps: 60.000000 0.000691
Last message repeated 1 times
[rtsp @ 0xaaaae93d1130] rfps: 120.000000 0.002764
Last message repeated 1 times
[rtsp @ 0xaaaae93d1130] rfps: 240.000000 0.011056
Last message repeated 1 times
[rtsp @ 0xaaaae93d1130] rfps: 29.970030 0.000317
Last message repeated 1 times
[rtsp @ 0xaaaae93d1130] rfps: 59.940060 0.001267
Last message repeated 1 times
Input #0, rtsp, from 'rtsp://ha.dante.local:8554/front-yard':
Metadata:
title : go2rtc/1.5.0
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0, 28, 1/90000: Video: h264, 1 reference frame, yuv420p(progressive), 2560x1920, 0/1, 30 tbr, 90k tbn
Stream #0:1, 15, 1/16000: Audio: aac, 16000 Hz, mono, fltp
Successfully opened the file.
Parsing a group of options: output url pipe:.
Applying option f (force format) with argument rawvideo.
Applying option pix_fmt (set pixel format) with argument yuv420p.
Successfully parsed a group of options.
Opening an output file: pipe:.
[pipe @ 0xaaaae941dd50] Setting default whitelist 'crypto,data'
Successfully opened the file.
[h264_mp4toannexb @ 0xaaaae93d0ff0] The input looks like it is Annex B already
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
Stream mapping:
Stream #0:0 -> #0:0 (h264 (h264_nvmpi) -> rawvideo (native))
Press [q] to stop, [?] for help
[vost#0:0/rawvideo @ 0xaaaae971d460] cur_dts is invalid [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
Last message repeated 626 times
[vost#0:0/rawvideo @ 0xaaaae971d460] Finishing stream without any data written to it.
detected 8 logical cores
[graph 0 input from stream 0:0 @ 0xaaaae971e080] Setting 'video_size' to value '2560x1920'
[graph 0 input from stream 0:0 @ 0xaaaae971e080] Setting 'pix_fmt' to value '0'
[graph 0 input from stream 0:0 @ 0xaaaae971e080] Setting 'time_base' to value '1/90000'
[graph 0 input from stream 0:0 @ 0xaaaae971e080] Setting 'pixel_aspect' to value '0/1'
[graph 0 input from stream 0:0 @ 0xaaaae971e080] Setting 'frame_rate' to value '30/1'
[graph 0 input from stream 0:0 @ 0xaaaae971e080] w:2560 h:1920 pixfmt:yuv420p tb:1/90000 fr:30/1 sar:0/1
[format @ 0xaaaae971e3f0] Setting 'pix_fmts' to value 'yuv420p'
[AVFilterGraph @ 0xaaaae96e9170] query_formats: 4 queried, 3 merged, 0 already done, 0 delayed
Output #0, rawvideo, to 'pipe:':
Metadata:
title : go2rtc/1.5.0
encoder : Lavf60.3.100
Stream #0:0, 0, 1/30: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 2560x1920 (0x0), 0/1, q=2-31, 1769472 kb/s, 30 fps, 30 tbn
Metadata:
encoder : Lavc60.3.100 rawvideo
[out#0/rawvideo @ 0xaaaae93deb80] All streams finished
[out#0/rawvideo @ 0xaaaae93deb80] Terminating muxer thread
[AVIOContext @ 0xaaaae92dcf10] Statistics: 0 bytes written, 0 seeks, 0 writeouts
frame= 0 fps=0.0 q=0.0 Lsize= 0kB time=-577014:32:22.77 bitrate= -0.0kbits/s speed=N/A
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (rtsp://ha.dante.local:8554/front-yard):
Input stream #0:0 (video): 412 packets read (10908937 bytes); 0 frames decoded;
Input stream #0:1 (audio): 215 packets read (110080 bytes);
Total: 627 packets (11019017 bytes) demuxed
Output file #0 (pipe:):
Output stream #0:0 (video): 0 frames encoded; 0 packets muxed (0 bytes);
Total: 0 packets (0 bytes) muxed
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
0 frames successfully decoded, 0 decoding errors
Terminating demuxer thread 0
Exiting normally, received signal 2.
root@431f1de541b7:/opt/frigate#
w3sip/jetson-ffmpeg@de0b0391a9cc8f71763cf030556ae40c812759a7 fixes this issue
See: https://github.com/jocover/jetson-ffmpeg/issues/113
I built ffmpeg 6.0 and am able to reproduce the issue. It's particularly problematic with go2rtc (an OSS restreaming system used by Frigate).