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: 
destruk
Binge Watcher

Automatic Video Runtime?

The 'Runtime' field is utilizing seconds for all displays. Is there any quicker/easier way to automatically determine the runtime of a streaming video file, like reading metadata encoded at the beginning of the stream for dynamic population of the field?
0 Kudos
3 REPLIES 3
RokuKevin
Visitor

Re: Automatic Video Runtime?

The firmware does not currently do this. You must provide the runtime in your feeds.

--Kevin
0 Kudos
destruk
Binge Watcher

Re: Automatic Video Runtime?

This looks complex but should work fine for MP3's
http://www.zedwood.com/article/127/php- ... ion-of-mp3
dang...I just tried that php code out and it is FAST. Nifty.

Array ( [Filesize] => 107394921 [Encoding] => CBR [MPEG version] => 11 [Layer Description] => 01 [Protection Bit] => 1 [Bitrate Index] => 0111 [Sampling Freq Idx] => 00 [Padding Bit] => 0 [Private Bit] => 0 [Channel Mode] => 01 [Mode Extension] => 00 [Copyright] => 0 [Original Media] => 0 [Emphasis] => 0 [Bitrate] => 96 [Sampling Rate] => 44100 [Frame Size] => 314 [Length] => 8949 [Length mm:ss] => 149:09 )
note - their code is inaccurate if you have embedded artwork in the mp3 - this calculation is 4 seconds too long.

Does anyone have access to similar server side code to determine the runtime for mp4 and m4v video files the ROKU can use?
0 Kudos
TomCorwine
Channel Surfer

Re: Automatic Video Runtime?

"destruk" wrote:
This looks complex but should work fine for MP3's
http://www.zedwood.com/article/127/php- ... ion-of-mp3

Does anyone have access to similar server side code to determine the runtime for mp4 and m4v video files the ROKU can use?


Does that work with VBR mp3s? Looking at the code, it seems to just do a rudimentary calculation of the bitrate divided into the file size. I believe calculating the length of VBR mp3s is a bit more difficult.

Great resource, though. I might play with it later on and see how well it works.
0 Kudos