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

Does rtp-to-webrtc support h264 #2021

Closed
patrickcorrigan opened this issue Nov 15, 2021 · 2 comments
Closed

Does rtp-to-webrtc support h264 #2021

patrickcorrigan opened this issue Nov 15, 2021 · 2 comments

Comments

@patrickcorrigan
Copy link

patrickcorrigan commented Nov 15, 2021

I've been using Pion to successfully realtime steam VP8 Video using the example https://github.com/pion/webrtc/tree/master/examples/rtp-to-webrtc

I'd like to try using h264 for the hardware acceleration but the stream starts but them seems to stop after a few seconds

I've been using this ffmpeg command succesfully for capturing the rtp stream for VP8

# ffmpeg -re -f x11grab -draw_mouse 0 -framerate 60 -video_size 640x480 -i :0+642,340 -vcodec libvpx -crf 10 -b:v 3M -cpu-used 8 -deadline 1 -g 10 -error-resilient 1 -auto-alt-ref 1 -an -f rtp rtp://127.0.0.1:5004?pkt_size=1200 &

and it works well

I've tried a few different command for h264 but none of them last more than a few seconds.

ffmpeg -re -f x11grab -draw_mouse 0 -framerate 60 -video_size 640x480 -i :0+642,340 -c:v libx264 -bsf:v h264_mp4toannexb -b:v 2M -max_delay 0 -bf 0 -an -f rtp rtp://127.0.0.1:5004?pkt_size=1200 &

Is it a keyframe issue?

@patrickcorrigan
Copy link
Author

Got it working using 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

Found here #1652 (comment)

@Sean-Der
Copy link
Member

Hey @patrickcorrigan

also make sure to do baseline constrained. You can see the appropriate settings in gstreamer-src

It would be great if you could open a PR with the proper H264 settings in the README!

daonb pushed a commit to daonb/webrtc that referenced this issue Nov 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants