1

As I am trying to connect the VLC Python Bindings with ffmpeg (see Exchange data between ffmpeg and video player) I thought that making ffmpeg to output the RTSP stream to STDOUT and "catching" it with a Python script and sending over HTTP would be a good idea. So I made a tiny HTTP server using SimpleHTTPServer from which I get the STDIN from FFMpeg and "output" it to the web.

This is the syntax I am using:

ffmpeg.exe -y -i rtsp://fms30.mediadirect.ro/live/utv/utv?tcp -acodec copy -vcodec copy -f flv - | \Python27\python.exe -u stdin2http.py

This seems to work, I can access the stream but nor the video, nor audio is playing. I tried with VLC on Windows, VLC and MPlayer on Linux and no success. Simply running

ffmpeg.exe -y -i rtsp://fms30.mediadirect.ro/live/utv/utv?tcp -acodec copy -vcodec copy -f flv - | vlc.exe -

works perfectly. So the problem seems to be when I'm writing the data from stdin to the web server. What I am doing wrong?

Community
  • 1
  • 1
ov1d1u
  • 958
  • 1
  • 17
  • 38
  • I'm thinking that something might be wrong with your stdin2http.py script. – Multimedia Mike Mar 14 '12 at 16:40
  • I'm thinking to that too - but what could be wrong? Here's the script: http://pastebin.com/NDRtFhVp – ov1d1u Mar 14 '12 at 18:15
  • vlc can stream by itself. Why do you need ffmpeg, python? – jfs Mar 14 '12 at 18:50
  • rtsp://fms30.mediadirect.ro/live/utv/utv by example it's not working in VLC. This is streamed over TCP, and seems that VLC doesn't support RTSP over TCP too well. So I'm trying to use ffmpeg as a proxy. – ov1d1u Mar 14 '12 at 20:56

1 Answers1

2

I played around with your stdin2http.py script. First, I was able to stream a media file (H.264 .mp4 file in my case) from a simple web server (webfsd) to VLC via HTTP. Then I tried the same thing using 'stdin2http.py < h264-file.mp4'. It didn't take.

I used the 'ngrep' utility to study the difference in the network conversations between the 2 servers. I think if you want to make this approach work, you will need to make stdin2http.py smarter and work with HTTP content ranges (which might involve a certain amount of buffering stdin data in your script in order to deal possible jumps in the stream).

Multimedia Mike
  • 12,660
  • 5
  • 46
  • 62