views:

1206

answers:

1

I've got a Sony network camera (SNC-RZ25N) that I am trying desperately to get data from in some meaningful format. The documentation says it sends MPEG-4 raw data, but is not more specific than than. I can capture a segment of the stream using curl ( http://techhead.biz/media/tsv.m4v ) and it will play using VLC and ffplay (though it plays too fast in ffplay).

After a day and a half of tinkering, I just discovered that I cannot use ffmpeg to convert this stream directly. For one, the only way ffmpeg accepts piped data as input (that I'm aware of) is in the 'yuv4mpegpipe' format.

I tried piping to ffmpeg using 'm4v' as the specified format, but it seems to want to read the entire stream before it begins processing.

Anyone know how I can do this? Using commandline tools? Open source libraries in ANY programming language? Simpler solutions are preferred, but any working solution would be great.

+1  A: 

It appears mplayer can play your m4v file over HTTP, and at least with your sample file this works:

mkfifo /tmp/fifo
mplayer -benchmark -vo yuv4mpeg:file=/tmp/fifo http://techhead.biz/media/tsv.m4v
ffmpeg -f yuv4mpegpipe -i /tmp/fifo -vcodec libx264 -vpre libx264-hq /tmp/foo.mp4

(-benchmark tells mplayer to ignore frame duration, might or might not be needed)

Alternatively, with just mencoder:

mencoder -o /tmp/foo.avi -of avi -ovc x264 -x264encopts bitrate=250 http://techhead.biz/media/tsv.m4v

Finally, if you don't actually need H.264, you could just put the existing MPEG-ES data in whatever container format you need; MP4Box might be able to do this, and ffmpeg and mencoder can if they support the output format.

derobert
Thanks. I've been trying something similar with VLC. It plays for a while and then hangs. I don't know if it's VLC or ffmpeg. It seems everything, VLC and mplayer included, use ffmpeg (or at least libavcodec) to decode MPEG-4. Of course, what I ultimately want is a way to redistribute this content to users. We have Flash Media Server already installed, but I've been having difficulty bridging the gap and am open to other solutions.
Jonathan Hawkes
vlc and mplayer definitely use different code the fetch the video, so mplayer may work where vlc doesn't. Also, you could probably use mencoder and skip the ffmpeg call alltogether, giving you a third approach to try. I'll update the answer with this.
derobert