DirectShow Capture support

Announcements made by users.
mobi1300
Posts: 14
Joined: Tue Aug 28, 2012 4:44 am

Re: DirectShow Capture support

Post by mobi1300 » Sun Oct 21, 2012 9:03 pm

what about mjpeg?
>> using -vcodec mjpeg -i ... -vcodec copy -f mjpeg , I can see frames getting copied

can you specify a muxer with -f mp4 ?
>> using -vcodec h264 -i ... -vcodec copy -f mp4, no frames were copied. Leaving this setup running for a while didn't change the output.

If its feasible at your end, I can ship the camera to you, and let you work on it.

Thanks

rogerdpack
Posts: 1877
Joined: Fri Aug 05, 2011 9:56 pm

Re: DirectShow Capture support

Post by rogerdpack » Wed Oct 24, 2012 5:25 pm

my only concern is that I may have to keep it for months trying to figure out what is going on...if you're ok with that then send it on, otherwise in a month or 2 I'll hopefully buy my own and try it out.
-r

mobi1300
Posts: 14
Joined: Tue Aug 28, 2012 4:44 am

DirectShow Capture and streaming

Post by mobi1300 » Sat Oct 27, 2012 8:18 pm

Hello:

I've an application, where I need to stream and capture pics of the same stream at random intervals ( user triggered).

To support this I start a ffmpeg session with 2 outputs:

a. h264 stream (rtmp) to a media server
b. mjpeg stream (udp) to a local server

I then start an another ffmpeg session to read the udp stream and extract a frame from it.

While all this works, the capture session (from the udp stream) takes about 5-6 seconds to grab a frame, making this setup quite inaccurate.

Is there a better way of doing this ? How can I make the capture session quick ?

Thanks

mobi1300
Posts: 14
Joined: Tue Aug 28, 2012 4:44 am

Re: DirectShow Capture support

Post by mobi1300 » Sat Oct 27, 2012 8:19 pm

rogerdpack wrote:my only concern is that I may have to keep it for months trying to figure out what is going on...if you're ok with that then send it on, otherwise in a month or 2 I'll hopefully buy my own and try it out.
-r
I sent you a PM for the shipping coordinates.

rogerdpack
Posts: 1877
Joined: Fri Aug 05, 2011 9:56 pm

Re: DirectShow Capture and streaming

Post by rogerdpack » Mon Oct 29, 2012 1:12 pm

mobi1300 wrote:Hello:

I've an application, where I need to stream and capture pics of the same stream at random intervals ( user triggered).

To support this I start a ffmpeg session with 2 outputs:

a. h264 stream (rtmp) to a media server
b. mjpeg stream (udp) to a local server

I then start an another ffmpeg session to read the udp stream and extract a frame from it.

While all this works, the capture session (from the udp stream) takes about 5-6 seconds to grab a frame, making this setup quite inaccurate.

Is there a better way of doing this ? How can I make the capture session quick ?

Thanks
How does your setup support random capture?
Is it 5-6 seconds just to startup and capture the frame? is it using 100% cpu?
http://ffmpeg.org/trac/ffmpeg/wiki/Stre ... de#Latency might be helpful.

mobi1300
Posts: 14
Joined: Tue Aug 28, 2012 4:44 am

Re: DirectShow Capture and streaming

Post by mobi1300 » Tue Oct 30, 2012 4:55 am

rogerdpack wrote:
mobi1300 wrote:Hello:

I've an application, where I need to stream and capture pics of the same stream at random intervals ( user triggered).

To support this I start a ffmpeg session with 2 outputs:

a. h264 stream (rtmp) to a media server
b. mjpeg stream (udp) to a local server

I then start an another ffmpeg session to read the udp stream and extract a frame from it.

While all this works, the capture session (from the udp stream) takes about 5-6 seconds to grab a frame, making this setup quite inaccurate.

Is there a better way of doing this ? How can I make the capture session quick ?

Thanks
Here is the whole cmd:

ffmpeg-32 -f dshow -s 432x240 -pix_fmt yuv420p -i video="Logitech HD Pro Webcam C920" -vcodec libx264 -f flv junk01.mp4 -vcodec mjpeg -r 10 -f mjpeg udp://127.0.0.1:6666


(shown here with file not rtmp)

How does your setup support random capture?

When I need to do a capture, I simply fire an another instance of ffmpeg, like this:
.\ffmpeg-32 -f mjpeg -r 10 -i udp://127.0.0.1:6666 -frames 1 -f image2 pic2.jpg

Is it 5-6 seconds just to startup and capture the frame? is it using 100% cpu?

The capture process from the start to finish takes 5-6 ( sometimes longer). The CPU barely goes over 10%, even with both the instances running.


http://ffmpeg.org/trac/ffmpeg/wiki/Stre ... de#Latency might be helpful.
As you can see, I am sending mjpeg frames to the local server, hoping delineating them would be easier that way. Tried playing with the -analyzeperiod but much luck.

Thanks.

rogerdpack
Posts: 1877
Joined: Fri Aug 05, 2011 9:56 pm

Re: DirectShow Capture support

Post by rogerdpack » Tue Oct 30, 2012 1:31 pm

how often is it sending frames? you might get some useful info using -loglevel debug. Unfortunately I don't have the ability to try and reproduce it here, I wonder what is going on...also hopefully with some improvements in libavfilter in the (long or short) future we can create a filter that "takes a single snapshot" or the like, that would avoid startup cost...

waspy
Posts: 3
Joined: Tue Dec 18, 2012 4:31 pm

Re: DirectShow Capture support

Post by waspy » Tue Dec 18, 2012 4:46 pm

Hello, I'd like to know if there are any news concerning the problem of @mobi1300. I've got a similar one. Dealing with a couple of different commands, I'm not able to get a working mp4-outputfile, which is playable from WMP or VLC - although it does from ffplay and wowza (wondering).

Code: Select all

ffmpeg -loglevel debug -r 10 -f dshow -i video="SMP WebCam" -c:v libx264 webcam.mp4
ffmpeg -f dshow -i video="SMP WebCam" output.mkv
ffmpeg -f dshow -i video="SMP WebCam" output.mp4
On the other side, outputformats such as avi or flv works as expected:

Code: Select all

ffmpeg -loglevel debug -r 10 -f dshow -i video="SMP WebCam" -c:v libx264 webcamflv.flv
ffmpeg -loglevel debug -r 10 -f dshow -i video="SMP WebCam" -c:v libx264 webcamflv.avi
Don't know where to start, finding a solution for this, already tested a lot of different gits...

rogerdpack
Posts: 1877
Joined: Fri Aug 05, 2011 9:56 pm

Re: DirectShow Capture support

Post by rogerdpack » Tue Dec 18, 2012 7:11 pm

your problem is that the output is not playable (I think mobi300's problem was latency was too high) is that correct?
Anyway I'd guess you need to specify -pix_fmt yuv420p
as by default it encodes it to yuv422 or yuv444 or something, which isn't recognized by all players.
Anyway you can try it at least, though that it really weird that it works in an flv...hmm... :)

Could you post the console output of running $ ffmpeg -i filename
for each of the output files?

-roger-

waspy
Posts: 3
Joined: Tue Dec 18, 2012 4:31 pm

Re: DirectShow Capture support

Post by waspy » Tue Dec 18, 2012 8:49 pm

Thanks for your fast reply. I already tried your suggestion with pix_fmt and got some error-messages. Now I realized that it was my fault, setting the pix_fmt-argument behind the input-source does the magic :) Thank you very much!

Post Reply
'