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 » Tue Oct 16, 2012 5:02 am

That's what I am confused about as well.

I ran some tests:

A. format flv

./ffmpeg-32 -f dshow -s 432x240 -vcodec h264 -i video="..." -f flv test.m4v
and then dumping it

Input #0, flv, from 'test.m4v':
Metadata:
encoder : Lavf54.25.105
Duration: 00:00:14.48, start: 0.000000, bitrate: 169 kb/s
Stream #0:0: Video: flv1, yuv420p, 432x240, 200 kb/s, 62.50 tbr, 1k tbn, 1k tbc

B. format h264

./ffmpeg-32 -f dshow -s 432x240 -vcodec h264 -i video="..." -f h264 testh.m4v
and the dump:

Input #0, h264, from 'testh.m4v':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (High), yuvj420p, 432x240 [SAR 1:1 DAR 9:5], 62.50 fps, 62.50 tbr, 1200k tbn, 125 tbc

What's bothering is why flv1 shows up when I forced the format to flv ? I recall seeing someplace, ffmpeg uses SPARK as default.

FYI, the camera's (C920) product specs are quite explicit about the h.264 support.

Thanks

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

Re: DirectShow Capture support

Post by rogerdpack » Tue Oct 16, 2012 9:41 pm

mobi1300 wrote: ./ffmpeg-32 -f dshow -s 432x240 -vcodec h264 -i video="..." -f flv test.m4v
So do either of the resultant files "work" (for instance, the second, when read like
$ ffplay -f h264 -i test.m4v
or its ffmpeg equivalent).
what's your full command lines/console outputs (so I can see if it looks like it's transcoding or not)?

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

Re: DirectShow Capture support

Post by mobi1300 » Wed Oct 17, 2012 4:29 am

Roger:

Both can be played by ffplay. However, Windows Media Player was unable to decode any of the files.

The console output is attached:

PS C:\ffmpeg\ffmpeg-9-11> ..\ffmpeg-20121010-git-1a104bf-win32-static\bin\ffplay -f flv test.m4v
ffplay version N-45279-g1a104bf Copyright (c) 2003-2012 the FFmpeg developers
built on Oct 10 2012 19:19:16 with gcc 4.7.2 (GCC)
--cut--
Input #0, flv, from 'test.m4v':
Metadata:
encoder : Lavf54.25.105
Duration: 00:00:14.48, start: 0.000000, bitrate: 169 kb/s
Stream #0:0: Video: flv1, yuv420p, 432x240, 200 kb/s, 62.50 tbr, 1k tbn, 1k tbc
13504473Frame changed from size:0x0 to size:432x240
12.06 A-V: 0.000 fd= 0 aq= 0KB vq= 3KB sq= 0B f=0/0


PS C:\ffmpeg\ffmpeg-9-11> ..\ffmpeg-20121010-git-1a104bf-win32-static\bin\ffplay -f h264 testh.m4v
ffplay version N-45279-g1a104bf Copyright (c) 2003-2012 the FFmpeg developers
built on Oct 10 2012 19:19:16 with gcc 4.7.2 (GCC)
--cut--
[h264 @ 038dcec0] max_analyze_duration 5000000 reached at 5008000
[h264 @ 038dcec0] Estimating duration from bitrate, this may be inaccurate
Input #0, h264, from 'testh.m4v':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (High), yuvj420p, 432x240 [SAR 1:1 DAR 9:5], 62.50 fps, 62.50 tbr, 1200k tbn, 125 tbc
1350447409.44 A-V: 0.000 fd= 0 aq= 0KB vq= 0KB sFrame changed from size:0x0 to size:432x240
11.55 A-V: 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0

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

Re: DirectShow Capture support

Post by rogerdpack » Wed Oct 17, 2012 2:37 pm

Could I get full uncut command line and console output for both ffmpeg and ffplay for these cases? Also try running it with -loglevel debug.
Also does adding -vcodec copy help?
Also does vlc play them?


You might be able to tell from watching cpu usage whether or not it's doing an extra transcode or not.

As for WMP playing it, I find hardly anything (at least h264) plays in WMP by default (at least in XP-- -vcodec msmpeg4v2 to a .avi file works not sure what else). I'll experiment with windows 7...

what if you use .avi extension?

See also https://ffmpeg.org/trac/ffmpeg/ticket/1720 which has an off chance of being related...

Thanks!
-r

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

Re: DirectShow Capture support

Post by rogerdpack » Wed Oct 17, 2012 9:05 pm

Ok, for me, windows 7, encoding to flv1 results in a video that WMP can't play (My guess is WMP is at fault, thought it would be interesting to validate that.)

https://gist.github.com/3908048

But this one is playable in WMP:

Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x480 [SAR 32:27 DAR 16:9], 614 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc

As is this one:

Video: h264 (High) (avc1 / 0x31637661), yuvj420p, 720x480 [SAR 32:27 DAR 16:9], 659 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc

You could verify it by checking that http://rogerdpack.t28.net/incoming/yo.j420p.m4v plays in WMP for you.

a couple more ideas (after the other ones...)

try saving it as .mpg, from FFmpeg

try using mencoder, like mencoder.exe out.mpg -ovc copy -o out.mencoder.mpg
hmm...

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

Re: DirectShow Capture support

Post by mobi1300 » Thu Oct 18, 2012 5:36 am

Roger:

I am attaching two files with complete console output in the attached zip file.

I'll try some of the things you mentioned tomorrow.

How can I confirm, what the C920 is encoding is H.264 ? If this can be confirmed, then the issue points to ffmpeg, which for some reason is using flv1/SPARK container.

Thanks
Attachments
roger.7z
flv, h264
(3.06 KiB) Downloaded 169 times

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

Re: DirectShow Capture support

Post by rogerdpack » Thu Oct 18, 2012 3:22 pm

from the first:

[auto-inserted scaler 0 @ 05ca2b60] w:432 h:240 fmt:yuvj420p sar:1/1 -> w:432 h:240 fmt:yuv420p sar:1/1 flags:0x4
[flv @ 05ca2520] intra_quant_bias = 0 inter_quant_bias = -64
[h264 @ 0462d440] detected 8 logical cores
Output #0, flv, to 'roger_flv.mp4':
Metadata:
encoder : Lavf54.25.105
Stream #0:0, 0, 1/1000: Video: flv1 ([2][0][0][0] / 0x0002), yuv420p, 432x240 [SAR 1:1 DAR 9:5], 2/125, q=2-31, 200
kb/s, 1k tbn, 62.50 tbc
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> flv)

so it looks like it's transcoding to me.

The second also appears to be transcoding:

(h264 -> libx264)


Maybe upload the output of ffmpeg -i filename

for both, too, to see the generated metadata.

This makes it seem odd to me that they don't play in WMP, what OS are you using again?

I think you may want to try it with
-vcodec copy
and without
-f h264
at the end, since it apparently is still transcoding (?) so instead of

ffmpeg-32 -loglevel debug -f dshow -s 432x240 -vcodec h264 -i video="Logitech HD Pro
Webcam C920" -f h264 roger_h264.mp4

now do this:

ffmpeg-32 -loglevel debug -f dshow -s 432x240 -vcodec h264 -i video="Logitech HD Pro
Webcam C920" -vcodec copy roger_h264.mp4

then (see if it works) and post the console output, and output from ffmpeg -i output.

Thank you.
-r

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

Re: DirectShow Capture support

Post by rogerdpack » Fri Oct 19, 2012 12:38 am

you can tell that it's not transcoding if it says
(h264 -> copy)
or something like that...

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

Re: DirectShow Capture support

Post by mobi1300 » Fri Oct 19, 2012 4:52 am

-vcodec copy produced no frames!

Here is the console ouput:

C:\ffmpeg\ffmpeg-9-11>ffmpeg-32 -loglevel debug -f dshow -s 432x240 -vcodec h264 -i video="Logitech HD Pro
Webcam C920" -vcodec copy roger_h264_1018.mp4

ffmpeg version N-44267-g6d74313 Copyright (c) 2000-2012 the FFmpeg developers
built on Sep 11 2012 10:49:33 with gcc 4.7.1 (GCC)
configuration: --enable-memalign-hack --arch=x86 --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --ta
rget-os=mingw32 --cross-prefix=/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/mingw-w64-i686/bin/i686-w64-mingw32- -
-pkg-config=pkg-config --enable-libmp3lame --enable-version3 --enable-libvo-aacenc --enable-libvpx --extra-libs=-lws2_32
--extra-libs=-lpthread --enable-zlib --extra-libs=-lwinmm --extra-libs=-lgdi32 --enable-librtmp --enable-libvorbis --en
able-libtheora --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --disable-opt
imizations --enable-mmx --disable-postproc --enable-libflite --enable-fontconfig --enable-libass --enable-libutvideo --e
nable-runtime-cpudetect
libavutil 51. 72.100 / 51. 72.100
libavcodec 54. 55.100 / 54. 55.100
libavformat 54. 25.105 / 54. 25.105
libavdevice 54. 2.100 / 54. 2.100
libavfilter 3. 16.100 / 3. 16.100
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
[dshow @ 02cdf800] "Logitech HD Pro Webcam C920"
[dshow @ 02cdf800] Pin "Capture"
[dshow @ 02cdf800] pixel_format=bgr24 min s=640x480 fps=5 max s=640x480 fps=30
[dshow @ 02cdf800] pixel_format=bgr24 min s=160x90 fps=5 max s=160x90 fps=30
[dshow @ 02cdf800] pixel_format=bgr24 min s=160x120 fps=5 max s=160x120 fps=30
[dshow @ 02cdf800] pixel_format=bgr24 min s=176x144 fps=5 max s=176x144 fps=30
[dshow @ 02cdf800] pixel_format=bgr24 min s=320x180 fps=5 max s=320x180 fps=30
[dshow @ 02cdf800] pixel_format=bgr24 min s=320x240 fps=5 max s=320x240 fps=30
[dshow @ 02cdf800] pixel_format=bgr24 min s=352x288 fps=5 max s=352x288 fps=30
[dshow @ 02cdf800] pixel_format=bgr24 min s=432x240 fps=5 max s=432x240 fps=30
[dshow @ 02cdf800] pixel_format=bgr24 min s=640x360 fps=5 max s=640x360 fps=30
[dshow @ 02cdf800] pixel_format=bgr24 min s=800x448 fps=5 max s=800x448 fps=30
[dshow @ 02cdf800] pixel_format=bgr24 min s=800x600 fps=5 max s=800x600 fps=30
[dshow @ 02cdf800] pixel_format=bgr24 min s=864x480 fps=5 max s=864x480 fps=30
[dshow @ 02cdf800] pixel_format=bgr24 min s=960x720 fps=5 max s=960x720 fps=30
[dshow @ 02cdf800] pixel_format=bgr24 min s=1024x576 fps=5 max s=1024x576 fps=30
[dshow @ 02cdf800] pixel_format=bgr24 min s=1280x720 fps=5 max s=1280x720 fps=30
[dshow @ 02cdf800] pixel_format=bgr24 min s=1600x896 fps=5 max s=1600x896 fps=30
[dshow @ 02cdf800] pixel_format=bgr24 min s=1920x1080 fps=5 max s=1920x1080 fps=30
[dshow @ 02cdf800] pixel_format=bgr24 min s=2304x1296 fps=2 max s=2304x1296 fps=2
[dshow @ 02cdf800] pixel_format=bgr24 min s=2304x1536 fps=2 max s=2304x1536 fps=2
[dshow @ 02cdf800] pixel_format=yuv420p min s=640x480 fps=5 max s=640x480 fps=30
[dshow @ 02cdf800] pixel_format=yuv420p min s=160x90 fps=5 max s=160x90 fps=30
[dshow @ 02cdf800] pixel_format=yuv420p min s=160x120 fps=5 max s=160x120 fps=30
[dshow @ 02cdf800] pixel_format=yuv420p min s=176x144 fps=5 max s=176x144 fps=30
[dshow @ 02cdf800] pixel_format=yuv420p min s=320x180 fps=5 max s=320x180 fps=30
[dshow @ 02cdf800] pixel_format=yuv420p min s=320x240 fps=5 max s=320x240 fps=30
[dshow @ 02cdf800] pixel_format=yuv420p min s=352x288 fps=5 max s=352x288 fps=30
[dshow @ 02cdf800] pixel_format=yuv420p min s=432x240 fps=5 max s=432x240 fps=30
[dshow @ 02cdf800] pixel_format=yuv420p min s=640x360 fps=5 max s=640x360 fps=30
[dshow @ 02cdf800] pixel_format=yuv420p min s=800x448 fps=5 max s=800x448 fps=30
[dshow @ 02cdf800] pixel_format=yuv420p min s=800x600 fps=5 max s=800x600 fps=30
[dshow @ 02cdf800] pixel_format=yuv420p min s=864x480 fps=5 max s=864x480 fps=30
[dshow @ 02cdf800] pixel_format=yuv420p min s=960x720 fps=5 max s=960x720 fps=30
[dshow @ 02cdf800] pixel_format=yuv420p min s=1024x576 fps=5 max s=1024x576 fps=30
[dshow @ 02cdf800] pixel_format=yuv420p min s=1280x720 fps=5 max s=1280x720 fps=30
[dshow @ 02cdf800] pixel_format=yuv420p min s=1600x896 fps=5 max s=1600x896 fps=30
[dshow @ 02cdf800] pixel_format=yuv420p min s=1920x1080 fps=5 max s=1920x1080 fps=30
[dshow @ 02cdf800] pixel_format=yuv420p min s=2304x1296 fps=2 max s=2304x1296 fps=2
[dshow @ 02cdf800] pixel_format=yuv420p min s=2304x1536 fps=2 max s=2304x1536 fps=2
[dshow @ 02cdf800] vcodec=mjpeg min s=640x480 fps=5 max s=640x480 fps=30
[dshow @ 02cdf800] vcodec=mjpeg min s=160x90 fps=5 max s=160x90 fps=30
[dshow @ 02cdf800] vcodec=mjpeg min s=160x120 fps=5 max s=160x120 fps=30
[dshow @ 02cdf800] vcodec=mjpeg min s=176x144 fps=5 max s=176x144 fps=30
[dshow @ 02cdf800] vcodec=mjpeg min s=320x180 fps=5 max s=320x180 fps=30
[dshow @ 02cdf800] vcodec=mjpeg min s=320x240 fps=5 max s=320x240 fps=30
[dshow @ 02cdf800] vcodec=mjpeg min s=352x288 fps=5 max s=352x288 fps=30
[dshow @ 02cdf800] vcodec=mjpeg min s=432x240 fps=5 max s=432x240 fps=30
[dshow @ 02cdf800] vcodec=mjpeg min s=640x360 fps=5 max s=640x360 fps=30
[dshow @ 02cdf800] vcodec=mjpeg min s=800x448 fps=5 max s=800x448 fps=30
[dshow @ 02cdf800] vcodec=mjpeg min s=800x600 fps=5 max s=800x600 fps=30
[dshow @ 02cdf800] vcodec=mjpeg min s=864x480 fps=5 max s=864x480 fps=30
[dshow @ 02cdf800] vcodec=mjpeg min s=960x720 fps=5 max s=960x720 fps=30
[dshow @ 02cdf800] vcodec=mjpeg min s=1024x576 fps=5 max s=1024x576 fps=30
[dshow @ 02cdf800] vcodec=mjpeg min s=1280x720 fps=5 max s=1280x720 fps=30
[dshow @ 02cdf800] vcodec=mjpeg min s=1600x896 fps=5 max s=1600x896 fps=30
[dshow @ 02cdf800] vcodec=mjpeg min s=1920x1080 fps=5 max s=1920x1080 fps=30
[dshow @ 02cdf800] Pin "Capture"
[dshow @ 02cdf800] vcodec=h264 min s=640x480 fps=5 max s=640x480 fps=30
[dshow @ 02cdf800] vcodec=h264 min s=160x90 fps=5 max s=160x90 fps=30
[dshow @ 02cdf800] vcodec=h264 min s=160x120 fps=5 max s=160x120 fps=30
[dshow @ 02cdf800] vcodec=h264 min s=176x144 fps=5 max s=176x144 fps=30
[dshow @ 02cdf800] vcodec=h264 min s=320x180 fps=5 max s=320x180 fps=30
[dshow @ 02cdf800] vcodec=h264 min s=320x240 fps=5 max s=320x240 fps=30
[dshow @ 02cdf800] vcodec=h264 min s=352x288 fps=5 max s=352x288 fps=30
[dshow @ 02cdf800] vcodec=h264 min s=432x240 fps=5 max s=432x240 fps=30
[h264 @ 0469d440] Using externally provided dimensions
[dshow @ 02cdf800] All info found
[dshow @ 02cdf800] Estimating duration from bitrate, this may be inaccurate
Input #0, dshow, from 'video=Logitech HD Pro Webcam C920':
Duration: N/A, start: 411649.443000, bitrate: N/A
Stream #0:0, 28, 1/10000000: Video: h264 (Constrained Baseline), yuvj420p, 432x240 [SAR 1:1 DAR 9:5], 1/60, 62.50 tb
r, 10000k tbn, 60 tbc
Output #0, mp4, to 'roger_h264_1018.mp4':
Metadata:
encoder : Lavf54.25.105
Stream #0:0, 0, 1/10000000: Video: h264 ([33][0][0][0] / 0x0021), yuvj420p, 432x240 [SAR 1:1 DAR 9:5], 1/10000000, q
=2-31, 10000k tbn, 10000k tbc
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 0 fps=0.0 q=-1.0 Lsize= 0kB time=00:00:00.00 bitrate= 0.0kbits/s
video:0kB audio:0kB subtitle:0 global headers:0kB muxing overhead inf%
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)

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

Re: DirectShow Capture support

Post by rogerdpack » Fri Oct 19, 2012 5:01 am

what about mjpeg? can you specify a muxer with -f mp4 ? If you leave it for awhile does it show any error messages, or start working (might be waiting for an i-frame?)

Post Reply
'