github.com/pion/webrtc/v4@v4.0.1/examples/bandwidth-estimation-from-disk/README.md (about) 1 # bandwidth-estimation-from-disk 2 bandwidth-estimation-from-disk demonstrates how to use Pion's Bandwidth Estimation APIs. 3 4 Pion provides multiple Bandwidth Estimators, but they all satisfy one interface. This interface 5 emits an int for how much bandwidth is available to send. It is then up to the sender to meet that number. 6 7 ## Instructions 8 ### Create IVF files named `high.ivf` `med.ivf` and `low.ivf` 9 ``` 10 ffmpeg -i $INPUT_FILE -g 30 -b:v .3M -s 320x240 low.ivf 11 ffmpeg -i $INPUT_FILE -g 30 -b:v 1M -s 858x480 med.ivf 12 ffmpeg -i $INPUT_FILE -g 30 -b:v 2.5M -s 1280x720 high.ivf 13 ``` 14 15 ### Download bandwidth-estimation-from-disk 16 17 ``` 18 go install github.com/pion/webrtc/v4/examples/bandwidth-estimation-from-disk@latest 19 ``` 20 21 ### Open bandwidth-estimation-from-disk example page 22 [jsfiddle.net](https://jsfiddle.net/a1cz42op/) you should see two text-areas, 'Start Session' button and 'Copy browser SessionDescription to clipboard' 23 24 ### Run bandwidth-estimation-from-disk with your browsers Session Description as stdin 25 The `output.ivf` you created should be in the same directory as `bandwidth-estimation-from-disk`. In the jsfiddle press 'Copy browser Session Description to clipboard' or copy the base64 string manually. 26 27 Now use this value you just copied as the input to `bandwidth-estimation-from-disk` 28 29 #### Linux/macOS 30 Run `echo $BROWSER_SDP | bandwidth-estimation-from-disk` 31 #### Windows 32 1. Paste the SessionDescription into a file. 33 1. Run `bandwidth-estimation-from-disk < my_file` 34 35 ### Input bandwidth-estimation-from-disk's Session Description into your browser 36 Copy the text that `bandwidth-estimation-from-disk` just emitted and copy into the second text area in the jsfiddle 37 38 ### Hit 'Start Session' in jsfiddle, enjoy your video! 39 A video should start playing in your browser above the input boxes. When `bandwidth-estimation-from-disk` switches quality levels it will print the old and new file like so. 40 41 ``` 42 Switching from low.ivf to med.ivf 43 Switching from med.ivf to high.ivf 44 Switching from high.ivf to med.ivf 45 ``` 46 47 48 Congrats, you have used Pion WebRTC! Now start building something cool