Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
oojoshua
Visitor

Streaming H.264 Video

We are working on setting Roku up to be a set top box for an all IP-TV delivery system, so I thought I would share the progress from yesterday.

Since "professional" encoders often use consumer cards, linux software and marketing "magic" to squeeze $8,000/stream out of content providers, we are going to go a different direction.

Progress So Far:

The architecture is simple:

Video Source (HD Receiver, Sat Feed, Over-Air, DVD Player, AVI Archives, Etc.) Composite Out -> Hauppauge HD-PVR or HDHomeRun Tech Dual

Decoder USB 2.0 (or *.ts IP stream) -> Debian Lenny

Debian Lenny -> IP Network

IP Network -> Roku

Roku -> HDTV


The Decoder is COTS, so most of the work is going to be on Debian:

Configure ffserver. (Not as easy as it sounds, but an example below)

Pump the video into the local ffserver:


nohup ffmpeg -i /dev/video0 http://localhost:8090/feed1.ffm &


Now connect to the remote machine using (in this case) Media Center Classic.

File > Open File > http://IPADDRESS:8090/test.asf


The example below encodes the stream as mpeg4, but it can be encoded as H.264. The Roku box is then set to connect to the stream (haven't got that part working[started] yet).

ffserver even supports multiple output formats from the same input stream.

This approach is open source, relatively simple, and will allow you to encode broadbast HDTV, satallite fed HDTV, or output from a DVD player, or Fixed Camera.

We are now working with content providers to license the content. Restrictions are handled at the network level. Available to fiber members only at this time.

EXAMPLE ffserver setup. (Obviously final version will be of higher quality, however, be careful with lame. Bitrates above 41000 are flakey)


Port 8090
# bind to all IPs aliased or not
BindAddress 0.0.0.0
# max number of simultaneous clients
MaxClients 1000
# max bandwidth per-client (kb/s)
MaxBandwidth 10000
# Suppress that if you want to launch ffserver as a daemon.
NoDaemon

<Feed feed1.ffm>
File /tmp/feed1.ffm
FileMaxSize 10M
</Feed>

# ASF output - for media player classic
<Stream test.asf>

# the source feed
Feed feed1.ffm

# the output stream format - ASF
Format asf
VideoCodec mpeg4

# this must match the ffmpeg -r argument
VideoFrameRate 15

# generally leave this is a large number
VideoBufferSize 100000

# another quality tweak
VideoBitRate 768

# quality ranges - 1-31 (1 = best, 31 = worst)
VideoQMin 1
VideoQMax 5
VideoSize 352x240

# this sets how many seconds in past to start
PreRoll 0

# Audio Codec
AudioCodec libmp3lame
AudioBitRate 56
AudioChannels 2
AudioSampleRate 24000

</Stream>

<Stream stat.html>
Format status

# Only allow local people to get the status
ACL allow localhost
ACL allow 10.129.0.1 10.129.0.254

</Stream>


Joshua Montgomery
The Lawrence Freenet Project
Lawrence, KS
http://www.lawrencefreenet.org
0 Kudos
1 REPLY 1
oojoshua
Visitor

Noticed.....

I noticed that I messed up the config above. The bitrate is in "bits" so it needs a "k" behind it. Also the Minimum Quality was set to 5, which is too high for this encoding, this results in a buffer under run. Here is a valid config.


Port 8090
# bind to all IPs aliased or not
BindAddress 0.0.0.0
# max number of simultaneous clients
MaxClients 1000
# max bandwidth per-client (kb/s)
MaxBandwidth 10000
# Suppress that if you want to launch ffserver as a daemon.
NoDaemon

<Feed feed1.ffm>
File /tmp/feed1.ffm
FileMaxSize 10M
</Feed>

# ASF output - for media player classic
<Stream test.asf>

# the source feed
Feed feed1.ffm

# the output stream format - ASF
Format asf
VideoCodec mpeg4

# this must match the ffmpeg -r argument
VideoFrameRate 25

# generally leave this is a large number
VideoBufferSize 100000

# another quality tweak
VideoBitRate 768k

# quality ranges - 1-31 (1 = best, 31 = worst)
VideoQMin 1
VideoQMax 31
VideoSize 352x240

# this sets how many seconds in past to start
PreRoll 0

# Audio Codec
AudioCodec libmp3lame
AudioBitRate 56
AudioChannels 2
AudioSampleRate 24000

</Stream>

<Stream stat.html>
Format status

# Only allow local people to get the status
ACL allow localhost
ACL allow 10.129.0.1 10.129.0.254

</Stream>
Joshua Montgomery
The Lawrence Freenet Project
Lawrence, KS
http://www.lawrencefreenet.org
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.