github.com/pion/webrtc/v4@v4.0.1/examples/play-from-disk/README.md (about)

     1  # play-from-disk
     2  play-from-disk demonstrates how to send video and/or audio to your browser from files saved to disk.
     3  
     4  For an example of playing H264 from disk see [play-from-disk-h264](https://github.com/pion/example-webrtc-applications/tree/master/play-from-disk-h264)
     5  
     6  ## Instructions
     7  ### Create IVF named `output.ivf` that contains a VP8/VP9/AV1 track and/or `output.ogg` that contains a Opus track
     8  ```
     9  ffmpeg -i $INPUT_FILE -g 30 -b:v 2M output.ivf
    10  ffmpeg -i $INPUT_FILE -c:a libopus -page_duration 20000 -vn output.ogg
    11  ```
    12  
    13  **Note**: In the `ffmpeg` command which produces the .ivf file, the argument `-b:v 2M` specifies the video bitrate to be 2 megabits per second. We provide this default value to produce decent video quality, but if you experience problems with this configuration (such as dropped frames etc.), you can decrease this. See the [ffmpeg documentation](https://ffmpeg.org/ffmpeg.html#Options) for more information on the format of the value.
    14  
    15  ### Download play-from-disk
    16  
    17  ```
    18  go install github.com/pion/webrtc/v4/examples/play-from-disk@latest
    19  ```
    20  
    21  ### Open play-from-disk example page
    22  [jsfiddle.net](https://jsfiddle.net/8kup9mvn/) you should see two text-areas, 'Start Session' button and 'Copy browser SessionDescription to clipboard'
    23  
    24  ### Run play-from-disk with your browsers Session Description as stdin
    25  The `output.ivf` you created should be in the same directory as `play-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 `play-from-disk`
    28  
    29  #### Linux/macOS
    30  Run `echo $BROWSER_SDP | play-from-disk`
    31  #### Windows
    32  1. Paste the SessionDescription into a file.
    33  1. Run `play-from-disk < my_file`
    34  
    35  ### Input play-from-disk's Session Description into your browser
    36  Copy the text that `play-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. `play-from-disk` will exit when the file reaches the end
    40  
    41  Congrats, you have used Pion WebRTC! Now start building something cool