Streaming to youtube-live / stream copying from surveillance cam to youtube-live not recognized
Mail an ffmpeg-user@ffmpeg.org Hello ffmpeg-user-community, since some weeks I am trying to copy a stream from an rtsp-stream to a rtmp-stream (targeting youtube) without success. I have tested recent ffmpeg builds on Windows, and on my raspberry pi which is running ffmpeg version 4.4. What works: Version independed i can view the source stream by: ffplay -i rtsp://<user>:<password>@<camera-ip>/<url> It is also possible to write the stream to disk an view it using different viewers: VLC/Firefox/Windowsplayer and so on. I can easyly stream data from file(created with a GoPro-Camera) using rtmp to youtube-live. Almost instantly the stream is recognized and shows up after some seconds. What doesn't work: When I try to stream the data (stream or file) from my WebCams (D-Link or Trendnet) to youtube-live no stream is detected. --------------------------This works without problems--------------------------- C:\Temp\..\ffmpeg-master-latest-win64-gpl\bin>ffmpeg -i "c:\Temp\GOPR1903.MP4" -r 25 -f flv rtmp://a.rtmp.youtube.com/live2/5zq1-uztf-kuz2-ab21-ccda (<-just a sample key...) -------------------------------------------------------------------------------- ---------------------------The following seems to work, but w/o result,-------------------------------- --------------------------meaning no data stream is detected on youtube-live:-------------------------- (all ips and keys are randomly choosen...) C:\Temp\Software\MPlayer\ffmpeg-master-latest-win64-gpl\bin> ffmpeg -loglevel debug -i rtsp://<rtsp_usr>:ufwoierwe1321232@10.12.0.5/live1.sdp -rtsp_transport tcp -codec copy -bufsize 512k -g 50 -threads 2 -pix_fmt yuvj420p -f h264 "rtmp://a.rtmp.youtube.com/live2/5zq1-uztf-kuz2-ab21-ccda" ffmpeg version N-105439-g1530b3f566-20220131 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 11.2.0 (crosstool-NG 1.24.0.498_5075e1f) configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librist --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20220131 libavutil 57. 19.100 / 57. 19.100 libavcodec 59. 20.100 / 59. 20.100 libavformat 59. 17.101 / 59. 17.101 libavdevice 59. 5.100 / 59. 5.100 libavfilter 8. 26.101 / 8. 26.101 libswscale 6. 5.100 / 6. 5.100 libswresample 4. 4.100 / 4. 4.100 libpostproc 56. 4.100 / 56. 4.100 Splitting the commandline. Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'. Reading option '-i' ... matched as input url with argument 'rtsp://<rtsp_usr>:ufwoierwe1321232@10.12.0.5/live1.sdp'. Reading option '-rtsp_transport' ... matched as AVOption 'rtsp_transport' with argument 'tcp'. Reading option '-codec' ... matched as option 'codec' (codec name) with argument 'copy'. Reading option '-bufsize' ... matched as AVOption 'bufsize' with argument '512k'. Reading option '-g' ... matched as AVOption 'g' with argument '50'. Reading option '-threads' ... matched as AVOption 'threads' with argument '2'. Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'yuvj420p'. Reading option '-f' ... matched as option 'f' (force format) with argument 'h264'. Reading option 'rtmp://a.rtmp.youtube.com/live2/5zq1-uztf-kuz2-ab21-ccda' ... 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://<rtsp_usr>:ufwoierwe1321232@10.12.0.5/live1.sdp. Successfully parsed a group of options. Opening an input file: rtsp://<rtsp_usr>:ufwoierwe1321232@10.12.0.5/live1.sdp. [tcp @ 0000018186113c80] No default whitelist set [tcp @ 0000018186113c80] Original list of addresses: [tcp @ 0000018186113c80] Address 10.12.0.5 port 554 [tcp @ 0000018186113c80] Interleaved list of addresses: [tcp @ 0000018186113c80] Address 10.12.0.5 port 554 [tcp @ 0000018186113c80] Starting connection attempt to 10.12.0.5 port 554 [tcp @ 0000018186113c80] Successfully connected to 10.12.0.5 port 554 [rtsp @ 0000018186112e40] SDP: v=0 o=- 1647517328192495 1647517328192495 IN IP4 192.168.1.64 s=Media Presentation e=NONE b=AS:5050 t=0 0 a=control:rtsp://10.12.0.5:554/live1.sdp/ m=video 0 RTP/AVP 96 c=IN IP4 0.0.0.0 b=AS:5000 a=recvonly a=x-dimensions:1920,1080 a=control:rtsp://10.12.0.5:554/live1.sdp/trackID=1 a=rtpmap:96 H264/90000 a=fmtp:96 profile-level-id=420029; packetization-mode=1; sprop-parameter-sets=Z00AKZpkA8ARPy4C3AQEBQAAAwPoAADDUOhgAE+7AABPuku8uNDAAJ92AACfdJd5cKA=,aO48gA== a=Media_header:MEDIAINFO=494D4B48010200000400000100000000000000000000000000000000000000000000000000000000; a=appversion:1.0 [rtsp @ 0000018186112e40] video codec set to: h264 [rtsp @ 0000018186112e40] RTP Profile IDC: 42 Profile IOP: 0 Level: 29 [rtsp @ 0000018186112e40] RTP Packetization Mode: 1 [rtsp @ 0000018186112e40] Extradata set to 000001818495dac0 (size: 62) [rtp @ 000001818495bdc0] No default whitelist set [udp @ 000001818495d9c0] No default whitelist set [udp @ 000001818495d9c0] end receive buffer size reported is 393216 [udp @ 000001818495bec0] No default whitelist set [udp @ 000001818495bec0] end receive buffer size reported is 393216 [rtsp @ 0000018186112e40] setting jitter buffer size to 500 [rtsp @ 0000018186112e40] hello state=0 [h264 @ 000001818495d600] nal_unit_type: 7(SPS), nal_ref_idc: 3 [h264 @ 000001818495d600] nal_unit_type: 8(PPS), nal_ref_idc: 3 [h264 @ 000001818495d600] nal_unit_type: 7(SPS), nal_ref_idc: 3 [h264 @ 000001818495d600] nal_unit_type: 8(PPS), nal_ref_idc: 3 [h264 @ 000001818495d600] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3 [h264 @ 000001818495d600] Format yuvj420p chosen by get_format(). [h264 @ 000001818495d600] Reinit context to 1920x1088, pix_fmt: yuvj420p [h264 @ 000001818495d600] Frame num gap 1 511 [h264 @ 000001818495d600] nal_unit_type: 7(SPS), nal_ref_idc: 3 [h264 @ 000001818495d600] nal_unit_type: 8(PPS), nal_ref_idc: 3 [h264 @ 000001818495d600] nal_unit_type: 5(IDR), nal_ref_idc: 3 [h264 @ 000001818495d600] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3 Last message repeated 5 times [rtsp @ 0000018186112e40] first_dts 32400 not matching first dts NOPTS (pts NOPTS, duration 3600) in the queue [rtsp @ 0000018186112e40] max delay reached. need to consume packet [rtsp @ 0000018186112e40] RTP: missed 6 packets [rtsp @ 0000018186112e40] max delay reached. need to consume packet [rtsp @ 0000018186112e40] RTP: missed 3 packets [rtsp @ 0000018186112e40] All info found [rtsp @ 0000018186112e40] rfps: 24.500000 0.016899 [rtsp @ 0000018186112e40] rfps: 24.583333 0.011735 [rtsp @ 0000018186112e40] rfps: 24.666667 0.007509 Last message repeated 1 times [rtsp @ 0000018186112e40] rfps: 24.750000 0.004223 Last message repeated 1 times [rtsp @ 0000018186112e40] rfps: 24.833333 0.001876 Last message repeated 1 times [rtsp @ 0000018186112e40] rfps: 24.916667 0.000469 Last message repeated 1 times [rtsp @ 0000018186112e40] rfps: 25.000000 0.000000 [rtsp @ 0000018186112e40] rfps: 25.083333 0.000470 Last message repeated 1 times [rtsp @ 0000018186112e40] rfps: 25.166667 0.001880 Last message repeated 1 times [rtsp @ 0000018186112e40] rfps: 25.250000 0.004229 Last message repeated 1 times [rtsp @ 0000018186112e40] rfps: 25.333333 0.007517 Last message repeated 1 times [rtsp @ 0000018186112e40] rfps: 25.416667 0.011743 [rtsp @ 0000018186112e40] rfps: 25.500000 0.016909 [rtsp @ 0000018186112e40] rfps: 50.000000 0.000000 Input #0, rtsp, from 'rtsp://<rtsp_usr>:ufwoierwe1321232@10.12.0.5/live1.sdp': Metadata: title : Media Presentation Duration: N/A, start: 0.080000, bitrate: N/A Stream #0:0, 29, 1/90000: Video: h264 (Main), 1 reference frame, yuvj420p(pc, bt709, progressive, left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 0/1, 25 fps, 25 tbr, 90k tbn Successfully opened the file. Parsing a group of options: output url rtmp://a.rtmp.youtube.com/live2/5zq1-uztf-kuz2-ab21-ccda. Applying option codec (codec name) with argument copy. Applying option pix_fmt (set pixel format) with argument yuvj420p. Applying option f (force format) with argument h264. Successfully parsed a group of options. Opening an output file: rtmp://a.rtmp.youtube.com/live2/5zq1-uztf-kuz2-ab21-ccda. [rtmp @ 0000018187541780] No default whitelist set [tcp @ 0000018187541cc0] No default whitelist set [tcp @ 0000018187541cc0] Original list of addresses: [tcp @ 0000018187541cc0] Address 142.250.184.236 port 1935 [tcp @ 0000018187541cc0] Address 142.250.181.236 port 1935 [tcp @ 0000018187541cc0] Address 216.58.212.172 port 1935 [tcp @ 0000018187541cc0] Address 142.250.74.204 port 1935 [tcp @ 0000018187541cc0] Address 142.250.186.44 port 1935 [tcp @ 0000018187541cc0] Address 142.250.186.76 port 1935 [tcp @ 0000018187541cc0] Address 142.250.186.108 port 1935 [tcp @ 0000018187541cc0] Address 142.250.184.204 port 1935 [tcp @ 0000018187541cc0] Address 172.217.23.108 port 1935 [tcp @ 0000018187541cc0] Address 216.58.212.140 port 1935 [tcp @ 0000018187541cc0] Address 142.250.185.76 port 1935 [tcp @ 0000018187541cc0] Address 142.250.185.108 port 1935 [tcp @ 0000018187541cc0] Address 142.250.185.140 port 1935 [tcp @ 0000018187541cc0] Address 142.250.185.172 port 1935 [tcp @ 0000018187541cc0] Address 142.250.185.204 port 1935 [tcp @ 0000018187541cc0] Address 142.250.185.236 port 1935 [tcp @ 0000018187541cc0] Address 2a00:1450:4001:80e::200c port 1935 [tcp @ 0000018187541cc0] Address 2a00:1450:4001:830::200c port 1935 [tcp @ 0000018187541cc0] Address 2a00:1450:4001:800::200c port 1935 [tcp @ 0000018187541cc0] Address 2a00:1450:4001:801::200c port 1935 [tcp @ 0000018187541cc0] Interleaved list of addresses: [tcp @ 0000018187541cc0] Address 142.250.184.236 port 1935 [tcp @ 0000018187541cc0] Address 2a00:1450:4001:80e::200c port 1935 [tcp @ 0000018187541cc0] Address 142.250.181.236 port 1935 [tcp @ 0000018187541cc0] Address 2a00:1450:4001:830::200c port 1935 [tcp @ 0000018187541cc0] Address 216.58.212.172 port 1935 [tcp @ 0000018187541cc0] Address 2a00:1450:4001:800::200c port 1935 [tcp @ 0000018187541cc0] Address 142.250.74.204 port 1935 [tcp @ 0000018187541cc0] Address 2a00:1450:4001:801::200c port 1935 [tcp @ 0000018187541cc0] Address 142.250.186.44 port 1935 [tcp @ 0000018187541cc0] Address 142.250.186.76 port 1935 [tcp @ 0000018187541cc0] Address 142.250.186.108 port 1935 [tcp @ 0000018187541cc0] Address 142.250.184.204 port 1935 [tcp @ 0000018187541cc0] Address 172.217.23.108 port 1935 [tcp @ 0000018187541cc0] Address 216.58.212.140 port 1935 [tcp @ 0000018187541cc0] Address 142.250.185.76 port 1935 [tcp @ 0000018187541cc0] Address 142.250.185.108 port 1935 [tcp @ 0000018187541cc0] Address 142.250.185.140 port 1935 [tcp @ 0000018187541cc0] Address 142.250.185.172 port 1935 [tcp @ 0000018187541cc0] Address 142.250.185.204 port 1935 [tcp @ 0000018187541cc0] Address 142.250.185.236 port 1935 [tcp @ 0000018187541cc0] Starting connection attempt to 142.250.184.236 port 1935 [tcp @ 0000018187541cc0] Successfully connected to 142.250.184.236 port 1935 [rtmp @ 0000018187541780] Handshaking... [rtmp @ 0000018187541780] Type answer 3 [rtmp @ 0000018187541780] Server version 4.0.0.1 [rtmp @ 0000018187541780] Proto = rtmp, path = /live2/5zq1-uztf-kuz2-ab21-ccda, app = live2, fname = 5zq1-uztf-kuz2-ab21-ccda [rtmp @ 0000018187541780] Window acknowledgement size = 2500000 [rtmp @ 0000018187541780] Max sent, unacked = 57000000 [rtmp @ 0000018187541780] Releasing stream... [rtmp @ 0000018187541780] FCPublish stream... [rtmp @ 0000018187541780] Creating stream... [rtmp @ 0000018187541780] Sending publish command for '5zq1-uztf-kuz2-ab21-ccda' Successfully opened the file. Output #0, h264, to 'rtmp://a.rtmp.youtube.com/live2/5zq1-uztf-kuz2-ab21-ccda': Metadata: title : Media Presentation encoder : Lavf59.17.101 Stream #0:0, 0, 1/25: Video: h264 (Main), 1 reference frame, yuvj420p(pc, bt709, progressive, left), 1920x1080 (0x0) [SAR 1:1 DAR 16:9], 0/1, q=2-31, 25 fps, 25 tbr, 25 tbn Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream) cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream) [rtsp @ 0000018186112e40] max delay reached. need to consume packet [rtsp @ 0000018186112e40] RTP: missed 6 packets [rtsp @ 0000018186112e40] max delay reached. need to consume packet= 857.6kbits/s speed=2.67x [rtsp @ 0000018186112e40] RTP: missed 3 packets [rtsp @ 0000018186112e40] max delay reached. need to consume packet= 828.1kbits/s speed=2.12x [rtsp @ 0000018186112e40] RTP: missed 6 packets [rtsp @ 0000018186112e40] max delay reached. need to consume packet= 829.9kbits/s speed= 2.1x [rtsp @ 0000018186112e40] RTP: missed 9 packets [rtsp @ 0000018186112e40] max delay reached. need to consume packet= 805.4kbits/s speed=1.57x [rtsp @ 0000018186112e40] RTP: missed 9 packets [rtsp @ 0000018186112e40] max delay reached. need to consume packet= 833.0kbits/s speed=1.49x [rtsp @ 0000018186112e40] RTP: missed 9 packets [rtsp @ 0000018186112e40] max delay reached. need to consume packet= 813.4kbits/s speed= 1.3x [rtsp @ 0000018186112e40] RTP: missed 9 packets [rtsp @ 0000018186112e40] max delay reached. need to consume packet= 824.4kbits/s speed=1.37x [rtsp @ 0000018186112e40] RTP: missed 6 packets [rtsp @ 0000018186112e40] max delay reached. need to consume packet= 807.2kbits/s speed=1.31x [rtsp @ 0000018186112e40] RTP: missed 12 packets [rtsp @ 0000018186112e40] max delay reached. need to consume packet= 797.9kbits/s speed=1.25x [rtsp @ 0000018186112e40] RTP: missed 9 packets [rtsp @ 0000018186112e40] max delay reached. need to consume packet= 820.5kbits/s speed=1.24x [rtsp @ 0000018186112e40] RTP: missed 9 packets [rtsp @ 0000018186112e40] max delay reached. need to consume packet= 805.7kbits/s speed=1.23x [rtsp @ 0000018186112e40] RTP: missed 10 packets [q] command received. Exiting. frame= 269 fps= 25 q=-1.0 Lsize= 1179kB time=00:00:12.00 bitrate= 805.0kbits/s speed=1.14x video:1179kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000% Input file #0 (rtsp://<rtsp_usr>:ufwoierwe1321232@10.12.0.5/live1.sdp): Input stream #0:0 (video): 270 packets read (1231500 bytes); Total: 270 packets (1231500 bytes) demuxed Output file #0 (rtmp://a.rtmp.youtube.com/live2/5zq1-uztf-kuz2-ab21-ccda): Output stream #0:0 (video): 269 packets muxed (1207538 bytes); Total: 269 packets (1207538 bytes) muxed [AVIOContext @ 0000018186621e40] Statistics: 1207538 bytes written, 0 seeks, 269 writeouts [rtmp @ 0000018187541780] UnPublishing stream... [rtmp @ 0000018187541780] Deleting stream... 0 frames successfully decoded, 0 decoding errors --------------------------------------------Creating mp4 files on disk---------------------------------------------- The following runs w/o problems for hours... -------------------------------------------------------------------------------------------------------------------- C:\Temp\ffmpeg\ffmpeg-master-latest-win64-gpl\bin> ffmpeg -loglevel debug -i rtsp://<rtsp_usr>:ufwoierwe1321232@10.12.0.5/live1.sdp -rtsp_transport tcp -c:v copy -level 4.0 -movflags +faststart -r 25 -y -f mp4 c:\Temp\test2022.mp4 ffmpeg version N-105439-g1530b3f566-20220131 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 11.2.0 (crosstool-NG 1.24.0.498_5075e1f) configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librist --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20220131 libavutil 57. 19.100 / 57. 19.100 libavcodec 59. 20.100 / 59. 20.100 libavformat 59. 17.101 / 59. 17.101 libavdevice 59. 5.100 / 59. 5.100 libavfilter 8. 26.101 / 8. 26.101 libswscale 6. 5.100 / 6. 5.100 libswresample 4. 4.100 / 4. 4.100 libpostproc 56. 4.100 / 56. 4.100 Splitting the commandline. Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'. Reading option '-i' ... matched as input url with argument 'rtsp://<rtsp_usr>:ufwoierwe1321232@10.12.0.5/live1.sdp'. Reading option '-rtsp_transport' ... matched as AVOption 'rtsp_transport' with argument 'tcp'. Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'. Reading option '-level' ... matched as AVOption 'level' with argument '4.0'. Reading option '-movflags' ... matched as AVOption 'movflags' with argument '+faststart'. Reading option '-r' ... matched as option 'r' (set frame rate (Hz value, fraction or abbreviation)) with argument '25'. Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'. Reading option '-f' ... matched as option 'f' (force format) with argument 'mp4'. Reading option 'c:\Temp\test2022.mp4' ... matched as output url. Finished splitting the commandline. Parsing a group of options: global . Applying option loglevel (set logging level) with argument debug. Applying option y (overwrite output files) with argument 1. Successfully parsed a group of options. Parsing a group of options: input url rtsp://<rtsp_usr>:ufwoierwe1321232@10.12.0.5/live1.sdp. Successfully parsed a group of options. Opening an input file: rtsp://<rtsp_usr>:ufwoierwe1321232@10.12.0.5/live1.sdp. [tcp @ 000001b80d303380] No default whitelist set [tcp @ 000001b80d303380] Original list of addresses: [tcp @ 000001b80d303380] Address 10.12.0.5 port 554 [tcp @ 000001b80d303380] Interleaved list of addresses: [tcp @ 000001b80d303380] Address 10.12.0.5 port 554 [tcp @ 000001b80d303380] Starting connection attempt to 10.12.0.5 port 554 [tcp @ 000001b80d303380] Successfully connected to 10.12.0.5 port 554 [rtsp @ 000001b80d302d40] SDP: v=0 o=- 1647518336201230 1647518336201230 IN IP4 192.168.1.64 s=Media Presentation e=NONE b=AS:5050 t=0 0 a=control:rtsp://10.12.0.5:554/live1.sdp/ m=video 0 RTP/AVP 96 c=IN IP4 0.0.0.0 b=AS:5000 a=recvonly a=x-dimensions:1920,1080 a=control:rtsp://10.12.0.5:554/live1.sdp/trackID=1 a=rtpmap:96 H264/90000 a=fmtp:96 profile-level-id=420029; packetization-mode=1; sprop-parameter-sets=Z00AKZpkA8ARPy4C3AQEBQAAAwPoAADDUOhgAE+7AABPuku8uNDAAJ92AACfdJd5cKA=,aO48gA== a=Media_header:MEDIAINFO=494D4B48010200000400000100000000000000000000000000000000000000000000000000000000; a=appversion:1.0 [rtsp @ 000001b80d302d40] video codec set to: h264 [rtsp @ 000001b80d302d40] RTP Profile IDC: 42 Profile IOP: 0 Level: 29 [rtsp @ 000001b80d302d40] RTP Packetization Mode: 1 [rtsp @ 000001b80d302d40] Extradata set to 000001b80b8bd980 (size: 62) [rtp @ 000001b80b8bba80] No default whitelist set [udp @ 000001b80b8bd8c0] No default whitelist set [udp @ 000001b80b8bd8c0] end receive buffer size reported is 393216 [udp @ 000001b80b8bbb80] No default whitelist set [udp @ 000001b80b8bbb80] end receive buffer size reported is 393216 [rtsp @ 000001b80d302d40] setting jitter buffer size to 500 [rtsp @ 000001b80d302d40] hello state=0 [h264 @ 000001b80b8bd400] nal_unit_type: 7(SPS), nal_ref_idc: 3 [h264 @ 000001b80b8bd400] nal_unit_type: 8(PPS), nal_ref_idc: 3 [h264 @ 000001b80b8bd400] nal_unit_type: 7(SPS), nal_ref_idc: 3 [h264 @ 000001b80b8bd400] nal_unit_type: 8(PPS), nal_ref_idc: 3 [h264 @ 000001b80b8bd400] nal_unit_type: 7(SPS), nal_ref_idc: 3 [h264 @ 000001b80b8bd400] nal_unit_type: 8(PPS), nal_ref_idc: 3 [h264 @ 000001b80b8bd400] nal_unit_type: 5(IDR), nal_ref_idc: 3 [h264 @ 000001b80b8bd400] Format yuvj420p chosen by get_format(). [h264 @ 000001b80b8bd400] Reinit context to 1920x1088, pix_fmt: yuvj420p [h264 @ 000001b80b8bd400] nal_unit_type: 7(SPS), nal_ref_idc: 3 [h264 @ 000001b80b8bd400] nal_unit_type: 8(PPS), nal_ref_idc: 3 [h264 @ 000001b80b8bd400] nal_unit_type: 5(IDR), nal_ref_idc: 3 [h264 @ 000001b80b8bd400] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3 Last message repeated 4 times [rtsp @ 000001b80d302d40] first_dts 25200 not matching first dts NOPTS (pts NOPTS, duration 3600) in the queue [rtsp @ 000001b80d302d40] All info found [rtsp @ 000001b80d302d40] rfps: 24.416667 0.018117 [rtsp @ 000001b80d302d40] rfps: 24.500000 0.013312 [rtsp @ 000001b80d302d40] rfps: 24.583333 0.009246 Last message repeated 1 times [rtsp @ 000001b80d302d40] rfps: 24.666667 0.005919 Last message repeated 1 times [rtsp @ 000001b80d302d40] rfps: 24.750000 0.003331 Last message repeated 1 times [rtsp @ 000001b80d302d40] rfps: 24.833333 0.001482 Last message repeated 1 times [rtsp @ 000001b80d302d40] rfps: 24.916667 0.000372 Last message repeated 1 times [rtsp @ 000001b80d302d40] rfps: 25.000000 0.000000 [rtsp @ 000001b80d302d40] rfps: 25.083333 0.000367 Last message repeated 1 times [rtsp @ 000001b80d302d40] rfps: 25.166667 0.001474 Last message repeated 1 times [rtsp @ 000001b80d302d40] rfps: 25.250000 0.003319 Last message repeated 1 times [rtsp @ 000001b80d302d40] rfps: 25.333333 0.005903 Last message repeated 1 times [rtsp @ 000001b80d302d40] rfps: 25.416667 0.009226 Last message repeated 1 times [rtsp @ 000001b80d302d40] rfps: 25.500000 0.013288 [rtsp @ 000001b80d302d40] rfps: 25.583333 0.018088 [rtsp @ 000001b80d302d40] rfps: 50.000000 0.000000 Input #0, rtsp, from 'rtsp://<rtsp_usr>:ufwoierwe1321232@10.12.0.5/live1.sdp': Metadata: title : Media Presentation Duration: N/A, start: 0.040022, bitrate: N/A Stream #0:0, 28, 1/90000: Video: h264 (Main), 1 reference frame, yuvj420p(pc, bt709, progressive, left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 0/1, 25 fps, 25 tbr, 90k tbn Successfully opened the file. Parsing a group of options: output url c:\Temp\test2022.mp4. Applying option c:v (codec name) with argument copy. Applying option r (set frame rate (Hz value, fraction or abbreviation)) with argument 25. Applying option f (force format) with argument mp4. Successfully parsed a group of options. Opening an output file: c:\Temp\test2022.mp4. [file @ 000001b80da3ff00] Setting default whitelist 'file,crypto,data' Successfully opened the file. Output #0, mp4, to 'c:\Temp\test2022.mp4': Metadata: title : Media Presentation encoder : Lavf59.17.101 Stream #0:0, 0, 1/12800: Video: h264 (Main), 1 reference frame (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive, left), 1920x1080 (0x0) [SAR 1:1 DAR 16:9], 0/1, q=2-31, 25 fps, 25 tbr, 12800 tbn Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream) [mp4 @ 000001b80d465480] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly [mp4 @ 000001b80d465480] Non-monotonous DTS in output stream 0:0; previous: 0, current: 0; changing to 1. This may result in incorrect timestamps in the output file. frame= 1084 fps= 26 q=-1.0 size= 4352kB time=00:00:43.28 bitrate= 823.8kbits/s speed=1.03x [q] command received. Exiting. [mp4 @ 000001b80d465480] Starting second pass: moving the moov atom to the beginning of the file [mp4 @ 000001b80d465480] Opening 'c:\Temp\test2022.mp4' for reading [file @ 000001b80d474080] Setting default whitelist 'file,crypto,data' [AVIOContext @ 000001b80dbdcb00] Statistics: 4698440 bytes read, 0 seeks frame= 1095 fps= 26 q=-1.0 Lsize= 4594kB time=00:00:43.72 bitrate= 860.7kbits/s speed=1.03x video:4588kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.116785% Input file #0 (rtsp://<rtsp_usr>:ufwoierwe1321232@10.12.0.5/live1.sdp): Input stream #0:0 (video): 1095 packets read (4698392 bytes); Total: 1095 packets (4698392 bytes) demuxed Output file #0 (c:\Temp\test2022.mp4): Output stream #0:0 (video): 1095 packets muxed (4698392 bytes); Total: 1095 packets (4698392 bytes) muxed [AVIOContext @ 000001b80d5ee6c0] Statistics: 9402291 bytes written, 4 seeks, 39 writeouts 0 frames successfully decoded, 0 decoding errors ---------------------------- End -------------------- May be someone solved this already. Thanks in advance for any kind of help. Regards Christian
On Mar 17, 2022, at 12:16 PM, Christian Pickhardt <ch.pickhardt@t-online.de> wrote:
Mail an ffmpeg-user@ffmpeg.org
Hello ffmpeg-user-community, since some weeks I am trying to copy a stream from an rtsp-stream to a rtmp-stream (targeting youtube) without success.
I have tested recent ffmpeg builds on Windows, and on my raspberry pi which is running ffmpeg version 4.4.
What works: Version independed i can view the source stream by: ffplay -i rtsp://<user>:<password>@<camera-ip>/<url>
It is also possible to write the stream to disk an view it using different viewers: VLC/Firefox/Windowsplayer and so on. I can easyly stream data from file(created with a GoPro-Camera) using rtmp to youtube-live. Almost instantly the stream is recognized and shows up after some seconds.
What doesn't work: When I try to stream the data (stream or file) from my WebCams (D-Link or Trendnet) to youtube-live no stream is detected.
--------------------------This works without problems--------------------------- C:\Temp\..\ffmpeg-master-latest-win64-gpl\bin>ffmpeg -i "c:\Temp\GOPR1903.MP4" -r 25 -f flv rtmp://a.rtmp.youtube.com/live2/5zq1-uztf-kuz2-ab21-ccda (<-just a sample key...) --------------------------------------------------------------------------------
---------------------------The following seems to work, but w/o result,-------------------------------- --------------------------meaning no data stream is detected on youtube-live:-------------------------- (all ips and keys are randomly choosen...)
C:\Temp\Software\MPlayer\ffmpeg-master-latest-win64-gpl\bin> ffmpeg -loglevel debug -i rtsp://<rtsp_usr>:ufwoierwe1321232@10.12.0.5/live1.sdp -rtsp_transport tcp -codec copy -bufsize 512k -g 50 -threads 2 -pix_fmt yuvj420p -f h264 "rtmp://a.rtmp.youtube.com/live2/5zq1-uztf-kuz2-ab21-ccda”
Try changing -f h264 to -f flv. YouTube Stream Now prefers flv for some reason. Here’s what I use from a Wyze Cam v3 with RTSP firmware: ./ffmpeg -thread_queue_size 2048 -i 'rtsp://anonymous:password@192.168.1.49/live' -vcodec copy -acodec copy -t 2:00:00 -f flv "rtmp://a.rtmp.youtube.com/live2/my-youtube-streaming-key" and it works just fine: https://www.youtube.com/channel/UCIVY11504PcY2sy2qpRhiMg/live <https://www.youtube.com/channel/UCIVY11504PcY2sy2qpRhiMg/live> and from a Reolink RLC-423: ./ffmpeg -re -thread_queue_size 512 -rtsp_transport tcp -i "rtsp://anonymous:password@192.168.1.11:554" -f concat -safe 0 -i playlist.txt -vcodec copy -acodec copy -t 01:47:02 -f flv "rtmp://a.rtmp.youtube.com/live2/my-other-youtube-key” The playlist is because the Reolink doesn’t have an audio track, which YouTube Stream Now requires.
On 3/17/2022 12:25 PM, Steven Kan wrote:
The playlist is because the Reolink doesn’t have an audio track, which YouTube Stream Now requires. You could also add a silent audio source with something like "-f lavfi -i anullsrc" (check the options for anullsrc, you may need to tweek them).
(It's always a good idea to post the -complete- command output when there's an error or question.) z!
On Mar 17, 2022, at 1:46 PM, Carl Zwanzig <cpz@tuunq.com> wrote:
On 3/17/2022 12:25 PM, Steven Kan wrote: The playlist is because the Reolink doesn’t have an audio track, which YouTube Stream Now requires. You could also add a silent audio source with something like "-f lavfi -i anullsrc" (check the options for anullsrc, you may need to tweek them).
(It's always a good idea to post the -complete- command output when there's an error or question.).
The playlist is now a feature, not a bug :D https://www.youtube.com/channel/UCE0jx2Z6qbc5Co8x8Kyisag/live
participants (3)
-
Carl Zwanzig -
Christian Pickhardt -
Steven Kan