-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
SampleBuilder can't handle H264 #1652
Comments
Before we incorrectly ran Unmarshal on every RTP Payload. This worked for Opus and VP8 because it didn't care about the Payload Headers. However this would break H264. Relates to #1652
It seems like the SampleBuilder is condensing the SPS/PPS/IDR into one RTP packet and that is breaking things. GStreamer sends them as three distinict packets, with one timestamp. We then emit a Sample with them all in one Payload. That one Payload gets turned into one RTP packet. |
SampleBuilder isn't able to properly handle H264. We have multiple issues and until resolved we shouldn't suggest it. Relates to #1652
Definitely, there‘s an issue with H264. My test case(examples/rtp-to-webrtc) is under Pion webrtc version 3.0.4. Here‘s one piece of my code.
Environment: Windowns 10, Internal network with IP camera using UDP to push media streams(standard RTP packet).
It's weird when I use rtsp(H264) with this repo(https://github.com/deepch/RTSPtoWebRTC), all my IP camera work well in web page. Could you please give a clue about my problems? Thanks a lot! |
Hey @WhalenChan. Your issue isn't related to the SampleBuilder, but happy to help! My guess is that you aren't attaching a SPS/PPS to every IDR. You can see here the work that is involved. Can you try rtsp-bench it is a much more naieve version and might be all you need. Would you mind moving this conversation to Slack or the GitHub Discussions? Just so we can keep this issue related to original issue. thanks! |
@Sean-Der I got it, thanks for your help! |
did you get it to work? do you have an ffmpeg command line or patch to pion to make it work? we need to stream both from ffmpeg and hik cameras. |
what I gather from the sdp that ffmpeg spits out is it always uses packetization mode 1 (non-interleaved single nalu, with large nalus being fragmented into fu-a) |
btw: does pion have to actually do anything to the packets? I would have thought it can just forward them untouched. thats what we do in our own rtsp proxy implementation, though not sure if that works for webrtc? |
ok, I managed to solve it by adding some package processing stolen from here |
ffmpeg -re -f lavfi -i testsrc=size=640x480:rate=30 -pix_fmt yuv420p -c:v libx264 -bsf:v h264_mp4toannexb -cpu-used 5 -deadline 1 -g 10 -error-resilient 1 -auto-alt-ref 1 -f rtp rtp://127.0.0.1:5004?pkt_size=1200 Use this ffmpeg command , work well in both web page and VLC player. |
That is exactly the example i based my version on. I added signaling via websocket and had to modify the h264 nalus by adding start codes. |
Hello,I made many tests.And I find that web can play normal if we remove |
We just got a report in Slack from a user that wasn't able to use
rtp-to-webrtc
with H264.I am not sure what the issues are, investigating now.
The text was updated successfully, but these errors were encountered: