Created An Example on Live VP8 Transcoding + Packaging (markdown)

Kongqun Yang 2016-03-18 17:50:01 -07:00
parent 7c79e58ae8
commit d357cf2261
1 changed files with 29 additions and 0 deletions

@ -0,0 +1,29 @@
This example uses pipe to chain transcoding and packaging together. Another option is to use socket.
Assuming you have a live iptv stream available at `225.1.1.8:8001` at port `8001` with interface address `172.29.46.122`.
## Create Pipe
```
mkfifo pipe1
```
## Transcoding Command
```
ffmpeg -i udp://225.1.1.8:8001?localaddr=172.29.46.122 -g 90 -speed 4 -threads 8 -c:v libvpx -f webm pipe: > pipe1
```
Option `-speed 4` tells the encoder to encode really fast, sacrificing quality. This is needed otherwise ffmpeg is not fast enough to keep up with the live stream.
## Packaging Command
```
packager in=pipe1,stream=audio,init_segment=livehd-audio.webm,segment_template=livehd-audio-\$Number\$.webm in=pipe1,stream=video,init_segment=livehd-video.webm,template=livehd-video-\$Number\$.webm --mpd_output livehd.mpd --profile live --dump_stream_info --min_buffer_time=10 --time_shift_buffer_depth=300 --segment_duration=3 --io_block_size 65536
```
Option `-io_block_size 65536` tells packager to use an io_block_size of 65K for threaded io file. This is necessary as reading from pipe blocks until the specified number of bytes, which is specified in io_block_size for threaded io file, thus the value of io_block_size cannot be too large.
This example cannot be easily extended to support more streams and add encryption.