Skip to content

Commit 1ee5f79

Browse files
shiqifeng2000shiqifeng
andauthored
add hevc codec, along with a example for demonstration (#579)
* add hevc codec, along with a example for demonstration * update against formating check * update against formating check * update against formating check --------- Co-authored-by: shiqifeng <[email protected]>
1 parent 557186f commit 1ee5f79

File tree

8 files changed

+883
-6
lines changed

8 files changed

+883
-6
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ bytes = "1"
3030
lazy_static = "1"
3131
rand = "0.8"
3232

33+
memchr = "2.1.1"
3334

3435
[[example]]
3536
name = "rc-cycle"
@@ -86,6 +87,11 @@ name = "play-from-disk-h264"
8687
path = "examples/play-from-disk-h264/play-from-disk-h264.rs"
8788
bench = false
8889

90+
[[example]]
91+
name = "play-from-disk-hevc"
92+
path = "examples/play-from-disk-hevc/play-from-disk-hevc.rs"
93+
bench = false
94+
8995
[[example]]
9096
name = "play-from-disk-renegotiation"
9197
path = "examples/play-from-disk-renegotiation/play-from-disk-renegotiation.rs"
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# play-from-disk-hevc
2+
3+
play-from-disk-hevc demonstrates how to send hevc video and/or audio to your browser from files saved to disk.
4+
5+
## Instructions
6+
7+
### Create IVF named `output.265` that contains a hevc track and/or `output.ogg` that contains a Opus track
8+
9+
```shell
10+
ffmpeg -i $INPUT_FILE -an -c:v libx265 -bsf:v hevc_mp4toannexb -b:v 2M -max_delay 0 -bf 0 output.265
11+
ffmpeg -i $INPUT_FILE -c:a libopus -page_duration 20000 -vn output.ogg
12+
```
13+
14+
### Build/Run play-from-disk-hevc
15+
16+
```shell
17+
cargo run --example play-from-disk-hevc
18+
```
19+
20+
### Result and Output
21+
In the shell you opened, you should see from std that rtp of hevc get received and parsed
22+
23+
After all is done, an `xx.output` file should be created at the same directory of the src video file
24+
25+
Congrats, you have sent and received the hevc stream
26+
27+
## Notes
28+
- Maybe you will need to install libx265/opus for your ffmepg
29+
- Please update the stun server to the best match, google maybe slow/unaccessable in some certain region/circumstance

0 commit comments

Comments
 (0)