DirectShow Capture support

Announcements made by users.

DirectShow Capture support

Postby ramiro » Mon May 23, 2011 10:04 pm

Hi,

DirectShow Capture support has been added to FFmpeg this weekend. Kyle's latest build git-01a73d6 (2011-05-23) has it already. This is based on some code I wrote last year before I left FFmpeg development. It has not been extensively tested, but as to not let it bitrot on the mailinglist, Michael has committed it.

This is a great opportunity for you (yes, you!) to join FFmpeg development, by helping clean up the source code (there's some duplicate code from vfwcap, which should be factored out), adding information to the documentation, testing on various devices, adding more features (like capturing the desktop, accepting normal files, selecting channels in tuners), and fixing the inevitable bugs.

An example command-line is:
ffmpeg -f dshow -i video="USB2.0_Camera":audio="Microphone (USB Audio Device)" output.mkv

The input string is in the format video=<video device name>:audio=<audio device name>. It is possible to have two separate inputs (like -f dshow -i audio=foo -f dshow -i video=bar) but my limited tests had shown a better synchronism when both were used in the same input.

If you don't know the proper string to use for the devices, get GraphEdit http://www.videohelp.com/tools/GraphEdit , Go Graph->Insert Filters, and look at the devices under "Video Capture Sources" and "Audio Capture Sources".

Ramiro
Last edited by ramiro on Fri Jun 24, 2011 10:14 pm, edited 1 time in total.
ramiro
 
Posts: 153
Joined: Tue May 10, 2011 12:56 am

Re: DirectShow Capture support

Postby diegocr » Tue May 24, 2011 12:11 am

It works great! low cpu usage and good quality at very low bitrates... :)

Being able to capture the desktop will be quite great as well.

Btw, if you have K-Lite you can use GraphStudio which comes with it for the device string.
diegocr
 
Posts: 34
Joined: Fri May 13, 2011 6:14 am

Re: DirectShow Capture support

Postby Zeranoe » Tue May 24, 2011 1:24 am

I would like to work on this project, but I already have my hands full.

I really hope it's developed and maintained further.
User avatar
Zeranoe
Site Admin
 
Posts: 547
Joined: Sat May 07, 2011 7:12 pm

Re: DirectShow Capture support

Postby killerwake » Sat Jun 11, 2011 12:50 am

congratulations! this is awesome. I can help you guys testing, on the project.

well i tried the a virtual video capture device from the VidBlaster video switcher software, but keeps saying: [dshow @ 0034A340] real-time buffer 113% full! frame dropped!


D:\ffmpeg\bin>ffmpeg -f dshow -i video="VidBlaster":audio="Microfone (High Definition Audi" -r 25 -threads 0 -vcodec libx264 -f flv rtmp://www.xxxxxx.com:1945/live_app/live_2
ffmpeg version git-N-30610-g1929807, Copyright (c) 2000-2011 the FFmpeg develope
rs
built on Jun 7 2011 15:55:06 with gcc 4.5.3
configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable-
runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libo
pencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --
enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger
--enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enabl
e-libx264 --enable-libxavs --enable-libxvid --enable-zlib --disable-outdev=sdl -
-pkg-config=pkg-config
libavutil 51. 6. 1 / 51. 6. 1
libavcodec 53. 6. 1 / 53. 6. 1
libavformat 53. 2. 0 / 53. 2. 0
libavdevice 53. 1. 1 / 53. 1. 1
libavfilter 2. 14. 0 / 2. 14. 0
libswscale 0. 14. 1 / 0. 14. 1
libpostproc 51. 2. 0 / 51. 2. 0
[dshow @ 0034A340] Estimating duration from bitrate, this may be inaccurate
Input #0, dshow, from 'video=VidBlaster:audio=Microfone (High Definition Audi':
Duration: N/A, start: 31365.772000, bitrate: N/A
Stream #0.0: Video: rawvideo, bgr24, 640x360, 10000k tbr, 10000k tbn, 10000k
tbc
Stream #0.1: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
Incompatible pixel format 'bgr24' for codec 'libx264', auto-selecting format 'yu
v420p'
[dshow @ 0034A340] real-time buffer 68% full! frame dropped!
[dshow @ 0034A340] real-time buffer 90% full! frame dropped!
[dshow @ 0034A340] real-time buffer 113% full! frame dropped!
Last message repeated 91 times
[buffer @ 03CD3620] w:640 h:360 pixfmt:bgr24 tb:1/1000000 sar:0/1 sws_param:
[ffsink @ 03CD5E00] auto-inserting filter 'auto-inserted scaler 0' between the f
ilter 'src' and the filter 'out'
[scale @ 03CD6000] w:640 h:360 fmt:bgr24 -> w:640 h:360 fmt:yuv420p flags:0x4
[libx264 @ 03D306E0] Default settings detected, using medium profile
[libx264 @ 03D306E0] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
[libx264 @ 03D306E0] profile High, level 3.0
[libx264 @ 03D306E0] 264 - core 115 r1995 c1e60b9 - H.264/MPEG-4 AVC codec - Cop
yleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deb
lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 m
e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chro
ma_qp_offset=-2 threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_c
ompat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 we
ightb=1 open_gop=1 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=
0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4
ip_ratio=1.40 aq=1:1.00
Output #0, flv, to 'rtmp://www.zoe.pt:1945/zoe_tv/live_2':
Metadata:
encoder : Lavf53.2.0
Stream #0.0: Video: libx264, yuv420p, 640x360, q=2-31, 200 kb/s, 1k tbn, 25
tbc
[dshow @ 0034A340] real-time buffer 113% full! frame dropped!
Stream #0.1: Audio: libmp3lame, 44100 Hz, 2 channels, s16, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop, [?] for help
frame= 18 fps= 0 q=0.0 size= 0kB time=00:00:00.00 bitrate= 0.0kbits/s
frame= 31 fps= 30 q=0.0 size= 0kB time=00:00:00.00 bitrate= 0.0kbits/s
frame= 44 fps= 29 q=0.0 size= 0kB time=00:00:00.00 bitrate= 0.0kbits/s
[dshow @ 0034A340] real-time buffer 68% full! frame dropped!
[dshow @ 0034A340] real-time buffer 116% full! frame dropped!
frame= 48 fps= 19 q=17.0 size= 42kB time=00:00:00.-4 bitrate=-8527.2kbits
killerwake
 
Posts: 3
Joined: Sat Jun 11, 2011 12:39 am

Re: DirectShow Capture support

Postby ramiro » Sat Jun 11, 2011 5:07 am

You're trying to capture and stream at the same time. Capturing happens in another thread, if the stream is not fast enough it will halt the capture.
ramiro
 
Posts: 153
Joined: Tue May 10, 2011 12:56 am

Re: DirectShow Capture support

Postby killerwake » Sat Jun 11, 2011 5:32 am

does the same if i write to a file. there got to be something in the capture device, maybe detects the wrong params (frame rate) 100000? of the virtual device i don't know!
killerwake
 
Posts: 3
Joined: Sat Jun 11, 2011 12:39 am

Re: DirectShow Capture support

Postby ramiro » Sat Jun 11, 2011 3:03 pm

maybe x264 is too slow for real-time. have you tried mpeg2 or some simpler codec?
ramiro
 
Posts: 153
Joined: Tue May 10, 2011 12:56 am

Re: DirectShow Capture support

Postby killerwake » Sat Jun 11, 2011 6:48 pm

yeah! you are right ramiro, with mpeg shows less warnings, but if i do in real-time:

ffmpeg -i rtmp://www.xxx.com/live1 -vcodec libx264 -f flv rtmp://www.xxx.com/live2

it does smoothly without warnings!

if you want i can set up an rtmp stream server for you to test.
killerwake
 
Posts: 3
Joined: Sat Jun 11, 2011 12:39 am

Re: DirectShow Capture support

Postby andrixnet » Mon Jun 27, 2011 8:57 pm

Yes! Finally! It works!
Thank you guys.

There is still a lot of room for optimizations, win32 ffmpeg's current capture performance is quite low.

One immediate improvement I would suggest : the ability to list capture devices like this :
ffmpeg -f dshow -i list
(similar to how the vfwcap interface is documented and should work, though it doesn't)
andrixnet
 
Posts: 2
Joined: Mon Jun 27, 2011 8:30 pm

Re: DirectShow Capture support

Postby andrixnet » Mon Jun 27, 2011 8:59 pm

How do I capture audio from a DV camera ?

I get video device "Microsoft DV camera and VCR", but no separate audio device, when I connect the firewire cable.
andrixnet
 
Posts: 2
Joined: Mon Jun 27, 2011 8:30 pm

Next

Return to User Announcements

Who is online

Users browsing this forum: No registered users and 1 guest