Hi all,
I'm trying to livestream from a DirectShow video capture device to Flash Media Server using ffmpeg on Windows. I've tried all sorts of different options with very limited success. The command below is the best I've been able to do; it manages to connect to the server, but it keeps on showing messages like "Real-time buffer XX% full. Frame dropped!" and it drops a lot of the frames (sometimes all of them for several seconds in a row). The CPU and RAM usage is low (25% CPU, 2GB RAM of 6GB), and the bitrate is only around 300-400kbps, so I don't think that the problem is a lack of system resources. Does anyone have any tips as to what I'm doing wrong? Any help would be greatly appreciated!
ffmpeg\bin\ffmpeg.exe -f dshow -framerate 29.97 -i video="vMix Virtual Capture":audio="Microphone (Fast Track)" -pix_fmt yuv420p -sample_fmt s16 -vcodec libx264 -s vga -vb 500k -r 24 -re -g 120 -vprofile baseline -preset ultrafast -tune zerolatency -level 21 -acodec libvo_aacenc -ab 48k -ac 1 -ar 22050 -async 1 -threads 4 -rtbufsize 2000M -f flv "rtmp://<server-address>"
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 12 of 12
Thread
-
-
I would try stream with vlc instead, http://www.videolan.org/doc/streaming-howto/en/ . You can use h264 insde a rtmp stream. I use it to stream all my tvsport-channels.
-
I see. I didn't use rtmp mode, I use http{mime=video/x-flv},mux=ffmpeg{mux=flv} mode. RTMP isn't fully supported yet, see http://forum.videolan.org/viewtopic.php?f=7&t=97803
I have never tried just with ffmpeg. -
Have you tried streaming a video file to the server? If you're still getting problems with that, your upload speed might be a bottleneck. Check your connection with http://speedtest.net/ and post the details.
The syntax of ffmpeg has changed over the years and it's possible ffmpeg is ignoring some of your parameters, such as bitrate. While ffmpeg is running what bitrate is it encoding to? Also, what version of ffmpeg are you using?
I don't know anything about the rtbufsize option, but 2000M is HUGE.
The server you're trying to connect to might be a factor.
I can't help with streaming from a live capture device - I use ffmpeg on linux, and the way that it reads from devices is different to the Windows version. -
Hi,
Streaming a video file using the same parameters works fine. My connection is 1mbps upstream, and it should definitely be able to handle this.
The bitrate stays around where I set it; it doesn't seem to go a lot over, so I think ffmpeg must be recognizing my bitrate settings. I just downloaded ffmpeg from http://ffmpeg.zeranoe.com/builds/, so it's a very recent version.
As for rtbufsize, I read online that it's supposed to set the real time buffer size, and since ffmpeg was complaining about the buffer being full, I thought I'd try making it nice and big -- didn't seem to help at all . Maybe ffmpeg doesn't recognize that option anymore; I didn't find any mention of it in the official documentation.
My conclusion at this point is that this an issue with ffmpeg's DirectShow capturing. I can stream prerecorded files to the server without any issues. When I capture from the DirectShow device to a file instead of publishing to the RTMP server, it works fine for a bit (a few minutes) and then completely quits with more "Real time buffer full" messages.
I think I've come up with a feasible workaround. The video mixing application that I'm using has the ability to record the video to a file. I'll probably set my video mixing program to record to an MPEG file and have ffmpeg transcode and stream that file in realtime, as it's being written. I tried it tonight, and it seemed to work. Not as nice as capturing properly, but hey, it does the trick!
Thanks everyone for the replies and suggestions! -
Do you have a quad core system? I see you've got the -threads option set, but 25% CPU usage sounds like a single core being maxed out.
If you drop the framerate down to 5 or 10fps does it work any better? -
No, it's a dual-core PC. I tried lowering the framerate but it didn't seem to make any difference.
-
I'm pretty much out of suggestions.
One thing I've noticed with ffmpeg is the -re option (read input at native frame rate) only seems to work if it's the first command line option after ffmpeg.exe
I've found it useful when streaming existing video files, otherwise ffmpeg sends the stream to the server too quickly. I don't know if it has any effect when reading from a device though.
But at least you've found a workaround. -
Sorry to chime in late. Anyway here's how I (somewhat successfully) did an experiment stream once from FFmpeg to FMS.
http://betterlogic.com/roger/2012/08/ffmpeg-receiving-rtmp-stream-from-flash-media-server/
Similar Threads
-
Streaming MP4 using VLC and ffmpeg on Linux?
By bobc02 in forum Video Streaming DownloadingReplies: 2Last Post: 24th Sep 2011, 11:02 -
FFmpeg udp streaming errors
By Blekss in forum Video Streaming DownloadingReplies: 1Last Post: 31st May 2011, 10:28 -
ffmpeg network streaming
By lusky in forum Video Streaming DownloadingReplies: 4Last Post: 23rd Aug 2010, 07:04 -
Video streaming over http with vlc and ffmpeg
By lusky in forum Video Streaming DownloadingReplies: 4Last Post: 7th Apr 2010, 04:54 -
ffmpeg webcam streaming problem
By d3v1ous in forum Video Streaming DownloadingReplies: 0Last Post: 31st Jan 2010, 14:34