Include HDYC pixel format

Website, builds, or other suggestions.
lbgaus
Posts: 7
Joined: Wed Dec 26, 2012 5:32 am

Include HDYC pixel format

Post by lbgaus » Wed Dec 26, 2012 5:48 am

Hi there!

It would be really really awesome if this Win build of ffmpeg supported the HDYC pixel format so HD capturing from a Blackmagic Intensity/DeckLink card could be done through the dshow interface. VirtualDub can capture from BM cards quite well, in combination with x264vfw and mp3 as compression codecs, but it would be so nice to use ffmpeg and it's variety of output options.

Listing the options for the card with ffmpeg returns the following: (note the unknown compression type 0x43594448)

Code: Select all

ffmpeg.exe -f dshow -list_options true -i video="Decklink Video Capture"
ffmpeg version N-47062-g26c531c Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov 25 2012 12:25:21 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enabl
e-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libop
enjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --ena
ble-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52.  9.100 / 52.  9.100
  libavcodec     54. 77.100 / 54. 77.100
  libavformat    54. 37.100 / 54. 37.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 23.102 /  3. 23.102
  libswscale      2.  1.102 /  2.  1.102
  libswresample   0. 17.101 /  0. 17.101
  libpostproc    52.  2.100 / 52.  2.100
[dshow @ 00000000003ee2e0] DirectShow video device options
[dshow @ 00000000003ee2e0]  Pin "Capture"
[dshow @ 00000000003ee2e0]   pixel_format=uyvy422  min s=720x486 fps=29.97 max s=720x486 fps=29.97
[dshow @ 00000000003ee2e0]   pixel_format=uyvy422  min s=720x486 fps=23.976 max s=720x486 fps=23.976
[dshow @ 00000000003ee2e0]   pixel_format=uyvy422  min s=720x576 fps=25 max s=720x576 fps=25
[dshow @ 00000000003ee2e0]   pixel_format=uyvy422  min s=720x486 fps=59.9402 max s=720x486 fps=59.9402
[dshow @ 00000000003ee2e0]   pixel_format=uyvy422  min s=720x576 fps=50 max s=720x576 fps=50
[dshow @ 00000000003ee2e0]   unknown compression type 0x43594448  min s=1920x1080 fps=23.976 max s=1920x1080 fps=23.976
[dshow @ 00000000003ee2e0]   unknown compression type 0x43594448  min s=1920x1080 fps=24 max s=1920x1080 fps=24
[dshow @ 00000000003ee2e0]   unknown compression type 0x43594448  min s=1920x1080 fps=25 max s=1920x1080 fps=25
[dshow @ 00000000003ee2e0]   unknown compression type 0x43594448  min s=1920x1080 fps=29.97 max s=1920x1080 fps=29.97
[dshow @ 00000000003ee2e0]   unknown compression type 0x43594448  min s=1920x1080 fps=30 max s=1920x1080 fps=30
[dshow @ 00000000003ee2e0]   unknown compression type 0x43594448  min s=1280x720 fps=50 max s=1280x720 fps=50
[dshow @ 00000000003ee2e0]   unknown compression type 0x43594448  min s=1280x720 fps=59.9402 max s=1280x720 fps=59.9402
[dshow @ 00000000003ee2e0]   unknown compression type 0x43594448  min s=1280x720 fps=60.0002 max s=1280x720 fps=60.0002
video=Decklink Video Capture: Immediate exit requested
According to http://www.fourcc.org/hdyc/, it's similar to uyvy422, so perhaps this would not take long to include in a special build of the Zeranoe source, or even the precompiled binaries on the site.

Thanks for any help that can be provided :-D

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

Re: Include HDYC pixel format

Post by rogerdpack » Wed Dec 26, 2012 7:13 pm

So this is CODEC_ID_MPEG2VIDEO do you think? (It's hard to add support without a piece of hardware to test it on :)

lbgaus
Posts: 7
Joined: Wed Dec 26, 2012 5:32 am

Re: Include HDYC pixel format

Post by lbgaus » Wed Dec 26, 2012 9:47 pm

I don't think so. At least for this particular usage, ffmpeg would be capturing rawvideo data from a DirectShow device. I'm really not all that well versed in the gritty details of codec tags and this sort of thing, but I *think* it would be CODEC_ID_RAWVIDEO based upon line 185 from https://github.com/libav/libav/blob/mas ... mat/riff.c.

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

Re: Include HDYC pixel format

Post by rogerdpack » Wed Dec 26, 2012 9:52 pm

Ok could you try to the 2 builds here that mention "ramiro" (referring to a patch of his): http://rogerdpack.t28.net/incoming/ffmpeg_distros/
Thanks.
-r

lbgaus
Posts: 7
Joined: Wed Dec 26, 2012 5:32 am

Re: Include HDYC pixel format

Post by lbgaus » Wed Dec 26, 2012 11:19 pm

Okay, thanks for the pointers. :) Some mixed results:

Using the same cmdline options for each of the tests: -f dshow -s 1920x1080 -r 29.97 -i video="Decklink Video Capture":audio="Decklink Audio Capture" -f mp4 -b:v 15M -b:a 320K video.mp4

64-bit versions of both those ramiro builds return

Code: Select all

[dshow @ 00000000002FF7A0] Unknown compression type. Please report verbose (-v 9) debug information.
which is what the official Zeranoe builds currently return as well. (adding -v 9 does nothing helpful, interestingly)

If I change the input res from 1920x1080 to 720x486 it works fine, and uses uyvy422 as indicated here:

Code: Select all

Input #0, dshow, from 'video=Decklink Video Capture:audio=Decklink Audio Capture':
  Duration: N/A, start: 137255.694000, bitrate: 1536 kb/s
    Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 720x486, 29.97 tbr, 10000k tbn, 29.97 tbc
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
However, using the 32-bit version of both gives:

Code: Select all

Input #0, dshow, from 'video=Blackmagic WDM Capture:audio=Decklink Audio Capture':
  Duration: N/A, start: 0.679088, bitrate: N/A
    Stream #0:0: Video: rawvideo, rgb555le, 1920x1080, 29.97 tbr, 10000k tbn, 29.97 tbc
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
which is definitely a step forward, although I don't know if rgb555le is the proper pixel format it should be detecting.

I should mention that on http://ffmpeg.org/trac/ffmpeg/wiki/DirectShow it says:
If you have a video capture card (ex: BlackMagic), it may not work (yet) out of the box with FFmpeg, as it lacks crossbar support presently. The work around currently is to install the AmerecTV software, which presents the capture card as directshow devices, then input the AmerecTV directshow devices into your FFmpeg.
I don't know what crossbar support is, or if ffmpeg still in fact lacks it, but I will try the Amerec trick also.

Here's where it gets really messy...

The recording file from the 32-bit build only shows a dark green display, but I saw VirtualDub do that in the beginning, and the solution was to open up the "Capture filter" option and set the input resolution to "HD 1080i 59.94 - 8 bit 4:2:2 YUV". This is some sort of DirectShow GUI dialog with the Blackmagic logo who's settings appear to be stored per-application. (For standard webcams, this GUI dialog has tabs like "Filters properties" and "Video Proc Amp", so it's apparently some sort of standard DirectShow device properties interface.) If there's no way to trigger this GUI dialog in ffmpeg, maybe I can find the registry location of those settings, if in fact they're stored there, and copy the properties saved for the VirtualDub exe. What a mess...

I can probably set up a Windows machine with a BM card in it and give you VNC access if you want to play around with ffmpeg to that extent. Again, your attention to this is very much appreciated.

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

Re: Include HDYC pixel format

Post by rogerdpack » Thu Dec 27, 2012 3:14 pm

Sure set one up with remote access, if you can leave it plugged in for a few weeks for me to look at it :)

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

Re: Include HDYC pixel format

Post by rogerdpack » Fri Dec 28, 2012 3:37 pm

Could you provide me with the output from "ffmpeg -f dshow -show_inputs -i video=XXX" using the build I provided you, as well?
Looks like HDYC is "raw pixel" but special, perhaps? http://www.fourcc.org/yuv.php

lbgaus
Posts: 7
Joined: Wed Dec 26, 2012 5:32 am

Re: Include HDYC pixel format

Post by lbgaus » Fri Jan 04, 2013 4:59 pm

Happy new year!

Performing that command on all the executables returned:

Code: Select all

Unrecognized option 'show_inputs'
Failed to set value '-i' for option 'show_inputs'
Is that the right option name? Thanks!

User avatar
Zeranoe
Site Admin
Posts: 702
Joined: Sat May 07, 2011 7:12 pm
Contact:

Re: Include HDYC pixel format

Post by Zeranoe » Fri Jan 04, 2013 5:12 pm

I recently created a batch script for the Black Magic Intensity Pro.

I pulled this off by using AmaRecTV to get the incoming stream.

I then used a AVS script to record both audio and video input from the AmaRecTV output and mux them together.

I finally fed the AVS script into FFmpeg and encoded using x264 and fdk aac.

There were a lot of steps, but the resulting video was perfect.

If you would like more information about this process, I would be happy to provide it.

lbgaus
Posts: 7
Joined: Wed Dec 26, 2012 5:32 am

Re: Include HDYC pixel format

Post by lbgaus » Fri Jan 04, 2013 6:16 pm

Having a script to work with would be awesome. Thank you for your efforts on this :D

Post Reply