Differences between revisions 4 and 5
Revision 4 as of 2010-10-15 07:02:04
Size: 1985
Editor: csr
Comment:
Revision 5 as of 2010-10-28 08:01:41
Size: 2471
Editor: csr
Comment:
Deletions are marked like this. Additions are marked like this.
Line 26: Line 26:

== Instantaneous Streaming ==

Some preliminary tests suggest we might be able to get near-instantaneous streaming with a chain like
{{{
 cat /bitarkiv/0244/files/mux2.1258192800-2009-11-14-11.00.00_1258196400-2009-11-14-12.00.00_dvb1-2.ts | dd bs=1880 skip=794118 count=1985295 | vlc - --program=2005 --demux=ts --intf dummy --play-and-exit --noaudio --novideo --sout '#std{access=file,mux=ts,dst=-}' |ffmpeg -i - -ar 44100 /usr/local/WowzaMediaServer/content/foobar.flv
}}}

The Naive Approach

The following recipe works for mux2:

dd if=mux2.ts bs=1024 skip=488281 | vlc - --program 2000 --demux=ts --intf dummy --play-and-exit --noaudio --novideo --sout '#std{access=file,mux=ts,dst=foobar_first.ts}'
vlc mux2.ts --program 2000 --demux=ts --intf dummy --play-and-exit --sout-file-append --noaudio --novideo --sout '#std{access=file,mux=ts,dst=foobar_first.ts}'
dd if=mux2.ts bs=1024 count=488281 | vlc - --program 2000 --demux=ts --intf dummy --play-and-exit --sout-file-append --noaudio --novideo --sout '#std{access=file,mux=ts,dst=foobar_first.ts}'
HandBrakeCLI -i foobar_first.ts -r 24 -e x264 -E faac --crop 0:0:0:0 --height 240 --vb 400 --optimize -o foobar.mp4

Note that it uses vlc as a demuxer and HandBrake as a transcoder. The bitrate (-r 24) video codec (-e x264) and audio codec (-E faac) are all necessary for successful streaming in Wowza. The test was with vlc 1.1.2 and HandBrakeCLI version svn3510 on Ubuntu Linux.

To speed up HandBrakeCLI one can pass additional x264 options: -x subq=1:nob_adapt:bframes=1:threads=auto:keyint=1000. This seems to give about a 50% total speedup compared with default values.

The Seamless Approach

The naive approach sometimes fails. It produces demuxed files which cause HandBrake to stall at the breaks between the original files. (One example is drhd_2009-11-13_21-15-00.xml.)

An alternative is to concatenate the raw transport stream files prior to demuxing. A command line example for the given program looks like

cat /bitarkiv/0244/files/mux2.1258142400-2009-11-13-21.00.00_1258146000-2009-11-13-22.00.00_dvb1-2.ts /bitarkiv/0244/files/mux2.1258146000-2009-11-13-22.00.00_1258149600-2009-11-13-23.00.00_dvb1-2.ts | dd bs=1880 skip=1191177 count=4367650 | vlc - --program=2030 --demux=ts --intf dummy --play-and-exit --noaudio --novideo --sout '#std{access=file,mux=ts,dst=seamless.ts}'

This seems to work much better.

Instantaneous Streaming

Some preliminary tests suggest we might be able to get near-instantaneous streaming with a chain like

 cat  /bitarkiv/0244/files/mux2.1258192800-2009-11-14-11.00.00_1258196400-2009-11-14-12.00.00_dvb1-2.ts  | dd bs=1880 skip=794118 count=1985295 | vlc - --program=2005 --demux=ts --intf dummy --play-and-exit --noaudio --novideo --sout '#std{access=file,mux=ts,dst=-}' |ffmpeg -i - -ar 44100 /usr/local/WowzaMediaServer/content/foobar.flv

ClipAndGlue (last edited 2010-11-01 11:37:20 by csr)