It should be noted the the below adds little to the current way LinHES enables iPod/iPhone streaming. The below is more proof of concept rather then practical use for most. With the latest iPhone software, apple is pushing HTTP Live streaming. It makes it possible to jump to the highest quality streaming video possible under ever changing cellular network conditions. What it also enables is the possibility of live video streaming as .ts files are supported. Streaming LiveTV to a cell is quite a killer app.
Refrencing heavily:
http://www.ioncannon.net/programming/45 ... segmenter/
Step 1 - Update ffmpeg
Seems ffmpeg needs to be upgraded from what is currently in use with standard R6 installs. From another board - "You must have the ffmpeg-devel RPM (V0.5-2 or later) and the ffmpeg-libs RPM (V0.5-2 or later) installed."
Solution
pacman -S ffmpeg which installs some svn updates and your good to go.
Step 2 - Segmenter Install - wget
http://svn.assembla.com/svn/legen/segmenter/
This is the bread and butter to the process. It took me a bit to get it to MAKE correctly, but that was due to the older ffmpeg version. Just update
Makefile to
install: in correct directory (I used
/usr/bin/). If the
all: settings don't work, you'll have to tweak according to the above discussion.
I've lost my
Makefile that worked for me.
From the commandline
#make
#make install
Step 3 - Updating webserver settings for streaming.
Edit
/etc/lighttpd/lighttpd.conf to add under "mimetype.assign"
Code:
".m3u8" => "application/x-mpegURL",
".ts" => "video/MP2T",
While your here, you might want to make sure you have:
Code:
".mp4" => "video/quicktime",
This last bit will allow you to stream from mythweb Myth2iPod page. Pretty SWEET!
Step 4 - html setup
In
/myth/ipodfeed create
iphonestreams.htmlpaste the below
Code:
<html>
<title>iPhone Streams</title>
<head>
<meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
</head>
<body style="background-color:#FFFFFF; ">
<center>
<video width='150' height='150' src="test-384.m3u8" />
</center>
</body>
</html>
edit /myth/ipodfeed/m2iweb.php and below <a href="/mythweb/status">Backend Status</a> insert:
Code:
|
<a href="/ipodfeed/iphonestreams.html">iPhone Streams</a>
This will link from the Myth2iPod page to the new webpage just created.
Step 5 - Encode
These settings work for a vob for me. Change the -b settings for different bitrates. Apple recommends 96 256 and 800. I find 384 good instead of 800, but adjust as needed.
Code:
ffmpeg -y -i /directory/to/vob/test.vob -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -s 320x240 -vcodec libx264 -b 384k -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 200k -maxrate 384k -bufsize 384k -ac 1 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -g 30 -async 2 test.ts
Now you have the encoded .ts file. Just need to break them up.
Code:
segmenter test.ts 10 test-384 test.m3u8 /ipodfeed/
This will take your test.ts and chop it into little 10 second bits.
Give it a try in your iPhone!
yourip/ipodfeed/m2iweb.phpYou should have another link after Backend Status | iPhone Streams
iPhone Streams will take you to a page with a video link displayed. I can't get a preview myself, if you figure that out, post.
Click the arrow and you should have video!
Now you should create streams with lower bitrates. Lather, rinse, repeat.
Just change the -b settings in the above ffmpeg script, say 96 or 256 or so. Run your segmenter script and again change the bitrate lable. When your done and have either 2 or 3 different bitrates of your file, create 1 last m3u8 file that points to all different bitrate options.
Something like the following:
Code:
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=128000
/ipodfeed/test-128.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=384000
/ipodfeed/test-384.m3u8
Lastly edit the
iphonestreams.html file to point to test.m3u8 or whatever you called your last m3u8 file.
Enjoy!
NEEDS: This is far away from production quality. The html code should reflect the mythweb template and standards. A script should be created to automate the encodes and segmentations. But both that and any LiveTV streaming is beyond my skills.