Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Video - RTMP packet size mismatch #695

Closed
modbender opened this issue Feb 16, 2024 · 9 comments
Closed

No Video - RTMP packet size mismatch #695

modbender opened this issue Feb 16, 2024 · 9 comments

Comments

@modbender
Copy link

modbender commented Feb 16, 2024

Subject of the issue
Restreamer keeps switching between No Video and proper video input.

Your environment
1st - Gaming Desktop - OBS Studio

  • RTX 3060 Ti
  • Windows 11
  • Ryzen 9 5900X
  • 1440p 60fps

2nd - Streaming CPU - Restreamer

  • Remote Controlled / AnyDesk
  • No dedicated GPU - Intel HD
  • Windows 10
  • Intel i5

Both connected to same router through Cat 6 Ethernet

Files
Instance 1 - Process Report
Instance 2 - Process Report

Steps to reproduce

  1. Setup a remote computer with Restreamer to be used with docker.
  2. Setup OBS Studio in main computer.
    image
  3. Connect both computers to same router through Ethernet.
  4. Allow port forwarding for 80/tcp to 8080/tcp.
  5. Start streaming on OBS using Display Capture (not window or game capture).

Awesome ⭐⭐⭐⭐⭐
If the Restreamer has problems processing your video signals, it would be constructive if you send us this origin stream by mail with the GitHub issue number to support@datarhei.com. This way, we can better see why the Restreamer is not working correctly.

Expected behavior
Should allow smooth live streaming input from OBS Studio to Restreamer through LAN IP regardless of what is being streamed, should not keep switching between "No Video" and Input video itself.

Actual behavior
I'm trying to stream games, my setup is - I have 2 computers, 1 computer is headless (only CPU, remote controlled, AnyDesk), the other is gaming rig, RTX 3060 Ti.

I have connected both to same router through CAT 6 ethernet, with port forwarding, everything seems fine when I start streaming it stays fine for some seconds.

I'm streaming like this -> Receive mode RTMP Stream from OBS to Restream

But then randomly Restreamer starts saying no video, also the probing returns 0x0 -
image
But usually when it's working it says 2560x1440 yuv420p.
image

OBS Studio doesn't show any drop in frames, and is properly passing at 25000 kbps CBR RTMP.

The FFMPEG command is as below:

ffmpeg -err_detect ignore_err -y -fflags +genpts -thread_queue_size 512 -analyzeduration 3000000 -i rtmp://localhost:1935/14e9c52d-f5bb-4364-bc30-e5e5695468bf.stream -dn -sn -map 0:1 -codec:v copy -map 0:0 -codec:a copy -metadata title=http://192.168.0.123:8080/14e9c52d-f5bb-4364-bc30-e5e5695468bf/oembed.json -metadata service_provider=datarhei-Restreamer -f hls -start_number 0 -hls_time 2 -hls_list_size 6 -hls_flags append_list+delete_segments+program_date_time+temp_file -hls_delete_threshold 4 -hls_segment_filename http://admin:admin@localhost:8080/memfs/14e9c52d-f5bb-4364-bc30-e5e5695468bf_output_0_%04d.ts -master_pl_name 14e9c52d-f5bb-4364-bc30-e5e5695468bf.m3u8 -master_pl_publish_rate 2 -method PUT http://admin:admin@localhost:8080/memfs/14e9c52d-f5bb-4364-bc30-e5e5695468bf_output_0.m3u8

The error in Process Details is as below
Issue Instance 1 - No Video at the very beginning.

ffmpeg version 5.1.3-datarhei Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219
  configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-alsa --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
 [tcp       ] RTMP packet size mismatch 13702311 != 2069426
 [tcp       ] RTMP packet size mismatch 10222502 != 4563957
 [tcp       ] RTMP packet size mismatch 12179093 != 6309257
 [flv       ] Could not find codec parameters for stream 1 (Video: h264, none, 128 kb/s): unspecified size
 Consider increasing the value for the 'analyzeduration' (3000000) and 'probesize' (5000000) options
 Input #0, flv, from 'rtmp://localhost:1935/14e9c52d-f5bb-4364-bc30-e5e5695468bf.stream':
   Metadata:
     displayWidth    : 2560
     displayHeight   : 1440
   Duration: N/A, start: 0.000000, bitrate: 256 kb/s
   Stream #0:0: Audio: aac, 44100 Hz, stereo, fltp, 128 kb/s
   Stream #0:1: Video: h264, none, 128 kb/s, 1k tbr, 1k tbn
 [http      ] HTTP error 404 Not Found
 Output #0, hls, to 'http://admin:admin@localhost:8080/memfs/14e9c52d-f5bb-4364-bc30-e5e5695468bf_output_0.m3u8':
   Metadata:
     displayWidth    : 2560
     displayHeight   : 1440
     title           : http://192.168.0.123:8080/14e9c52d-f5bb-4364-bc30-e5e5695468bf/oembed.json
     service_provider: datarhei-Restreamer
     encoder         : Lavf59.27.100
   Stream #0:0: Video: h264, none, q=2-31, 128 kb/s, 1k tbr, 90k tbn
   Stream #0:1: Audio: aac, 44100 Hz, stereo, fltp, 128 kb/s
 ffmpeg.mapping:{"graphs":[],"mapping":[{"input":{"index":0,"stream":1},"output":{"index":0,"stream":0},"copy":true},{"input":{"index":0,"stream":0},"output":{"index":0,"stream":1},"copy":true}]}
 Stream mapping:
   Stream #0:1 -> #0:0 (copy)
   Stream #0:0 -> #0:1 (copy)
 Press [q] to stop, [?] for help
 [tcp       ] RTMP packet size mismatch 182535 != 11431164
 rtmp://localhost:1935/14e9c52d-f5bb-4364-bc30-e5e5695468bf.stream: I/O error
 [hls       ] Opening 'http://admin:admin@localhost:8080/memfs/14e9c52d-f5bb-4364-bc30-e5e5695468bf_output_0_0000.ts' for writing
 [hls       ] Cannot use rename on non file protocol, this may lead to races and temporary partial files
 [hls       ] Opening 'http://admin:admin@localhost:8080/memfs/14e9c52d-f5bb-4364-bc30-e5e5695468bf.m3u8' for writing

Issue Instance 2 - In middle of a working live stream, sudden No Video

ffmpeg version 5.1.3-datarhei Copyright (c) 2000-2022 the FFmpeg developers
   built with gcc 11.2.1 (Alpine 11.2.1_git20220219) 20220219
   configuration: --extra-version=datarhei --prefix=/usr --extra-libs='-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl' --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-libv4l2 --enable-v4l2_m2m --enable-libfreetype --enable-alsa --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-debug --disable-doc --disable-shared
   libavutil      57. 28.100 / 57. 28.100
   libavcodec     59. 37.100 / 59. 37.100
   libavformat    59. 27.100 / 59. 27.100
   libavdevice    59.  7.100 / 59.  7.100
   libavfilter     8. 44.100 /  8. 44.100
   libswscale      6.  7.100 /  6.  7.100
   libswresample   4.  7.100 /  4.  7.100
   libpostproc    56.  6.100 / 56.  6.100
 Input #0, flv, from 'rtmp://localhost:1935/14e9c52d-f5bb-4364-bc30-e5e5695468bf.stream':
   Metadata:
     displayWidth    : 2560
     displayHeight   : 1440
   Duration: N/A, start: 0.019000, bitrate: N/A
   Stream #0:0: Audio: aac (LC), 48000 Hz, stereo, fltp
   Stream #0:1: Video: h264 (High), yuv420p(tv, bt709, progressive), 2560x1440 [SAR 1:1 DAR 16:9], 62.50 fps, 60 tbr, 1k tbn
 Output #0, hls, to 'http://admin:XNx3FpznOO0LjDY86n@localhost:8080/memfs/14e9c52d-f5bb-4364-bc30-e5e5695468bf_output_0.m3u8':
   Metadata:
     displayWidth    : 2560
     displayHeight   : 1440
     title           : http://192.168.0.123:8080/14e9c52d-f5bb-4364-bc30-e5e5695468bf/oembed.json
     service_provider: datarhei-Restreamer
     encoder         : Lavf59.27.100
   Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 2560x1440 [SAR 1:1 DAR 16:9], q=2-31, 62.50 fps, 60 tbr, 90k tbn
   Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp
 ffmpeg.mapping:{"graphs":[],"mapping":[{"input":{"index":0,"stream":1},"output":{"index":0,"stream":0},"copy":true},{"input":{"index":0,"stream":0},"output":{"index":0,"stream":1},"copy":true}]}
 Stream mapping:
   Stream #0:1 -> #0:0 (copy)
   Stream #0:0 -> #0:1 (copy)
 Press [q] to stop, [?] for help
 [hls       ] Opening 'http://admin:XNx3FpznOO0LjDY86n@localhost:8080/memfs/14e9c52d-f5bb-4364-bc30-e5e5695468bf_output_0_0384.ts' for writing
 [hls       ] Cannot use rename on non file protocol, this may lead to races and temporary partial files
 [hls       ] Opening 'http://admin:XNx3FpznOO0LjDY86n@localhost:8080/memfs/14e9c52d-f5bb-4364-bc30-e5e5695468bf.m3u8' for writing
 [hls       ] Opening 'http://admin:XNx3FpznOO0LjDY86n@localhost:8080/memfs/14e9c52d-f5bb-4364-bc30-e5e5695468bf_output_0_0385.ts' for writing
 [hls       ] Opening 'http://admin:XNx3FpznOO0LjDY86n@localhost:8080/memfs/14e9c52d-f5bb-4364-bc30-e5e5695468bf.m3u8' for writing
 [hls       ] Opening 'http://admin:XNx3FpznOO0LjDY86n@localhost:8080/memfs/14e9c52d-f5bb-4364-bc30-e5e5695468bf_output_0_0386.ts' for writing
 [hls       ] Opening 'http://admin:XNx3FpznOO0LjDY86n@localhost:8080/memfs/14e9c52d-f5bb-4364-bc30-e5e5695468bf_output_0_0387.ts' for writing
 [hls       ] Opening 'http://admin:XNx3FpznOO0LjDY86n@localhost:8080/memfs/14e9c52d-f5bb-4364-bc30-e5e5695468bf.m3u8' for writing
 [hls       ] Opening 'http://admin:XNx3FpznOO0LjDY86n@localhost:8080/memfs/14e9c52d-f5bb-4364-bc30-e5e5695468bf_output_0_0388.ts' for writing
 [mpegts    ] Opening 'http://admin:XNx3FpznOO0LjDY86n@localhost:8080/memfs/14e9c52d-f5bb-4364-bc30-e5e5695468bf_output_0_0378.ts' for writing
 [tcp       ] RTMP packet size mismatch 11813044 != 11033077
 [tcp       ] RTMP packet size mismatch 11507240 != 8319207
 rtmp://localhost:1935/14e9c52d-f5bb-4364-bc30-e5e5695468bf.stream: I/O error
 [hls       ] Opening 'http://admin:XNx3FpznOO0LjDY86n@localhost:8080/memfs/14e9c52d-f5bb-4364-bc30-e5e5695468bf_output_0_0389.ts' for writing
 [mpegts    ] Opening 'http://admin:XNx3FpznOO0LjDY86n@localhost:8080/memfs/14e9c52d-f5bb-4364-bc30-e5e5695468bf_output_0_0379.ts' for writing
 [hls       ] Opening 'http://admin:XNx3FpznOO0LjDY86n@localhost:8080/memfs/14e9c52d-f5bb-4364-bc30-e5e5695468bf.m3u8' for writing
 Exiting normally, received signal 2.
@modbender
Copy link
Author

I asked the same on discord a day back, seems very inactive... hoping to get some help here.

@modbender
Copy link
Author

Btw I have confirmed that this happens even when both Restreamer and obs, recording is all done in one and same computer.

@ioppermann
Copy link
Member

Thanks for bringing this forward. Did you also play around with the encoder settings in OBS?

I will try to reproduce it, however I won't be able to use NVENC.

@modbender
Copy link
Author

I did not try different settings in OBS yet... guess I'll start trying with 1080p.

@ioppermann ioppermann self-assigned this Feb 23, 2024
@modbender
Copy link
Author

modbender commented Feb 25, 2024

I tested it only once but seems to be stable... with 1080p 9000kbps

Unrelated... I do see this in YT, maybe Low Latency Setting causing it?
image

@ioppermann
Copy link
Member

ioppermann commented Mar 1, 2024

I was able to reproduce this. The problem was that the internal RTMP server struggled a bit with high bitrates. This has been fixed in the dev Docker images. Please try the datarhei/restreamer:dev Docker image and your original settings.

Regarding the other question: in OBS set a "Keyframe Interval" of 2 seconds. If you play around with the encoder settings it may reset this value to 0 which means that the encoder can set keyframes when it sees it fit. For streaming, a keyframe interval of 2 (as Youtube suggests) is ideal.

@modbender
Copy link
Author

Sure I will try and report back, thank you, this was very important as YouTube stream becomes crisp clear with 1440p and higher (switches to vp09 encoding)

@modbender
Copy link
Author

@ioppermann do you know of anyway to do HLS stream to Restream from OBS Studio?

@ioppermann
Copy link
Member

I'm not aware that OBS supports HLS streaming other than to Youtube.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants