This is a simple proof of concept of how a H264 stream can be captured by webrtc-rs and converted into a bitmap if the first packet contains a h264 frame (or something like that).
It does not work reliably because sometimes the first packet does not always contain the information needed but it should be enough to get started on a working solution.
The docs bellow are copy and pasted from the webrtc-rs example this is based on:
save-to-disk-h264 is a simple application that shows how to record your webcam/microphone using WebRTC.rs and save H264 and Opus to disk.
cargo build --example save-to-disk-h264
jsfiddle.net you should see your Webcam, two text-areas and a 'Start Session' button
In the jsfiddle the top textarea is your browser, copy that and:
Run echo $BROWSER_SDP | ./target/debug/examples/save-to-disk-h264
- Paste the SessionDescription into a file.
- Run
./target/debug/examples/save-to-disk-h264 < my_file
Copy the text that save-to-disk-h264
just emitted and copy into second text area
In the folder you ran save-to-disk-h264
you should now have a file output.h264
play with your video player of choice!
Congrats, you have used WebRTC.rs!