Include HDYC pixel format

Website, builds, or other suggestions.
rogerdpack
Posts: 1876
Joined: Fri Aug 05, 2011 9:56 pm

Re: Include HDYC pixel format

Post by rogerdpack » Fri Jan 25, 2013 7:19 pm

iotzo wrote:
ramiro wrote:
iotzo wrote:Hi there!
I want to contribute my little ugly patch which enables ffmpeg DirectShow HDYC capture from DeckLink:

Code: Select all

--- libavdevice/dshow.c 2013-01-19 14:24:06.782686914 +0200
+++ libavdevice/dshow_hdyc.c    2013-01-20 11:02:37.068708262 +0200
@@ -74,6 +74,7 @@
 {
     switch(biCompression) {
     case MKTAG('U', 'Y', 'V', 'Y'):
+    case MKTAG('H', 'D', 'Y', 'C'):
         return AV_PIX_FMT_UYVY422;
     case MKTAG('Y', 'U', 'Y', '2'):
         return AV_PIX_FMT_YUYV422;
rogerdpack, didn't you have a patch to remove dshow_codecid() entirely?
This patch affects dshow_pixfmt()
So that patch is enough, even though it's apparently in some "BT709" colorspace or something like that? I can submit it...

Also did you ask them if the mxf patch "breaking" you was expected or not?

iotzo
Posts: 35
Joined: Thu Jan 24, 2013 4:49 pm

Re: Include HDYC pixel format

Post by iotzo » Fri Jan 25, 2013 11:05 pm

So that patch is enough, even though it's apparently in some "BT709" colorspace or something like that? I can submit it...

Also did you ask them if the mxf patch "breaking" you was expected or not?
BT709 is my main concern and I’ll try to playback some captured colorbars these days and look at the vectorscope to see(eventually) for some colorshifts, but visually I can’t tell the difference between original and captured video(I don’t understand the theory and the source code completely and because of that I’m willing to do some practical testing ).
As for the MXFs, I’m referring the following patch:
http://ffmpeg.org/pipermail/ffmpeg-cvsl ... 56243.html
All ffmpeg builds after that patch can not produce playable (by my referent player) XDCAM HD MXF Op1a video if both video and audio tracks are present in the MXF. If MXF contains only video track it’s OK. In both cases VLC playback is OK, so I suppose that the problem is in my player (not in the patch).
Btw, here is the VLC patch and some explanations about BT709/BT601:
http://mailman.videolan.org/pipermail/v ... 51867.html
As I said before I don’t understand completely how to make correct patch but it works for me and it will be nice to see dshow DeckLink capture support in official ffmpeg source.

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

Re: Include HDYC pixel format

Post by rogerdpack » Sun Jan 27, 2013 12:51 am

iotzo wrote:
So that patch is enough, even though it's apparently in some "BT709" colorspace or something like that? I can submit it...

Also did you ask them if the mxf patch "breaking" you was expected or not?
BT709 is my main concern and I’ll try to playback some captured colorbars these days and look at the vectorscope to see(eventually) for some colorshifts, but visually I can’t tell the difference between original and captured video(I don’t understand the theory and the source code completely and because of that I’m willing to do some practical testing ).
As for the MXFs, I’m referring the following patch:
http://ffmpeg.org/pipermail/ffmpeg-cvsl ... 56243.html
All ffmpeg builds after that patch can not produce playable (by my referent player) XDCAM HD MXF Op1a video if both video and audio tracks are present in the MXF. If MXF contains only video track it’s OK. In both cases VLC playback is OK, so I suppose that the problem is in my player (not in the patch).
Btw, here is the VLC patch and some explanations about BT709/BT601:
http://mailman.videolan.org/pipermail/v ... 51867.html
As I said before I don’t understand completely how to make correct patch but it works for me and it will be nice to see dshow DeckLink capture support in official ffmpeg source.

Ok I'll send through your HDYC patch (with a question to them about the chroma space...) Are they aware of the breakage to your player?

iotzo
Posts: 35
Joined: Thu Jan 24, 2013 4:49 pm

Re: Include HDYC pixel format

Post by iotzo » Sun Jan 27, 2013 10:04 am

rogerdpack wrote:
iotzo wrote:
So that patch is enough, even though it's apparently in some "BT709" colorspace or something like that? I can submit it...

Also did you ask them if the mxf patch "breaking" you was expected or not?
BT709 is my main concern and I’ll try to playback some captured colorbars these days and look at the vectorscope to see(eventually) for some colorshifts, but visually I can’t tell the difference between original and captured video(I don’t understand the theory and the source code completely and because of that I’m willing to do some practical testing ).
As for the MXFs, I’m referring the following patch:
http://ffmpeg.org/pipermail/ffmpeg-cvsl ... 56243.html
All ffmpeg builds after that patch can not produce playable (by my referent player) XDCAM HD MXF Op1a video if both video and audio tracks are present in the MXF. If MXF contains only video track it’s OK. In both cases VLC playback is OK, so I suppose that the problem is in my player (not in the patch).
Btw, here is the VLC patch and some explanations about BT709/BT601:
http://mailman.videolan.org/pipermail/v ... 51867.html
As I said before I don’t understand completely how to make correct patch but it works for me and it will be nice to see dshow DeckLink capture support in official ffmpeg source.

Ok I'll send through your HDYC patch (with a question to them about the chroma space...)
Thank you!
Are they aware of the breakage to your player?
Nope, but this issue concerns a very few people I believe and unfortunately I can’t provide any useful logs or debug info.

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

Re: Include HDYC pixel format

Post by rogerdpack » Mon Jan 28, 2013 5:36 pm

iotzo wrote: Ok I'll send through your HDYC patch (with a question to them about the chroma space...)
Thank you!
Are they aware of the breakage to your player?
Nope, but this issue concerns a very few people I believe and unfortunately I can’t provide any useful logs or debug info.[/quote]



Ok could you try this (slight modification to you patch)...I found there was a place they were declaring HDYC already so thought I might try that instead :)

https://github.com/rdp/FFmpeg/commit/a5 ... 21b98d94ba
https://github.com/rdp/FFmpeg/commit/a5 ... d94ba.diff

if no response in a week I'll send it in.

I'm still not convinced that there's some type of conversion problem:

from http://comments.gmane.org/gmane.comp.vi ... .user/7707 the default may be "non full range"...except...I'm not sure what it would even do if presented a 0 (black) in that case...truncate it to black? that one will be tricky to see...maybe dark greys would all appear black, and "near whites" would all appear as straight white, I suppose...if they truncate. note to self: set color_range with it [add comment near HDYC]? the question is, is the default MPEG color space?


Also, they might be interested to know your player was broken, if it's "standards compliant" anyway, I'd at least mention it to them, just for their information :)

iotzo
Posts: 35
Joined: Thu Jan 24, 2013 4:49 pm

Re: Include HDYC pixel format

Post by iotzo » Mon Jan 28, 2013 7:59 pm

Well :) I've just compiled the ffmpeg version from your git repo and it's working :)

Code: Select all


F:\>ffmpeg_rdp.exe  -threads 4 -rtbufsize 512000k -framerate 25 -f dshow -video_size 1920x1080 -channels 2 -i video="Decklink VideoCapture":audio="Decklink Audio Capture" -filter_complex "[a] channelsplit=channel_layout=2 [FL][FR]" -map v -map [FL] -map [FR] -vcodec mpeg2video -pix_fmt yuv422p -flags  +ildct+ilme -top 1  -b:v 50000k -minrate:v 50000k -maxrate:v 50000k  -bufsize:v 36408333 -bf 2 -rc_max_vbv_use 1 -rc_min_vbv_use 1 -dc 10 -qmin 1 -lmin "1*QP2LAMBDA" -intra_vlc 1 -acodec pcm_s24le  -y rdp.mxf
ffmpeg version N-49406-ga50049a-iotzo Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan 28 2013 21:04:04 with gcc 4.7.2 (GCC)
  configuration: --enable-static --arch=x86_64 --target-os=mingw32 --cross-prefix=/root/sandbox/mingw-w64-x86_64/bin/x86_64-w64-ming
w32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --enable-libmp3lame --enable-version3
--enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable
-libgsm --enable-libfreetype --enable-fontconfig --enable-libass --enable-libutvideo --enable-libopus --disable-w32threads --enable-
frei0r --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable-libop
encore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libbluray --enable-libvpx --extra-
version=iotzo --enable-runtime-cpudetect
  libavutil      52. 17.100 / 52. 17.100
  libavcodec     54. 91.100 / 54. 91.100
  libavformat    54. 61.104 / 54. 61.104
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 34.101 /  3. 34.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[dshow @ 0000000002071200] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, dshow, from 'video=Decklink Video Capture:audio=Decklink Audio Capture':
  Duration: N/A, start: 0.093369, bitrate: 1536 kb/s
    Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 1920x1080, 25 tbr, 10000k tbn, 25 tbc
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Output #0, mxf, to 'rdp.mxf':
  Metadata:
    encoder         : Lavf54.61.104
    Stream #0:0: Video: mpeg2video, yuv422p, 1920x1080, q=1-31, 50000 kb/s, 25 tbn, 25 tbc
    Stream #0:1: Audio: pcm_s24le, 48000 Hz, 1 channels (FL), s32, 1152 kb/s
    Stream #0:2: Audio: pcm_s24le, 48000 Hz, 1 channels (FR), s32, 1152 kb/s
Stream mapping:
  Stream #0:1 (pcm_s16le) -> channelsplit (graph 0)
  Stream #0:0 -> #0:0 (rawvideo -> mpeg2video)
  channelsplit:FL (graph 0) -> Stream #0:1 (pcm_s24le)
  channelsplit:FR (graph 0) -> Stream #0:2 (pcm_s24le)
Press [q] to stop, [?] for help
frame=  182 fps= 25 q=4.2 Lsize=   47567kB time=00:00:07.29 bitrate=53452.0kbits/s
video:45229kB audio:2048kB subtitle:0 global headers:0kB muxing overhead 0.614486%
I noticed that HDYC support in ffmpeg was introduced in 2007:
http://git.videolan.org/?p=ffmpeg.git;a ... ed1f8729e4
, and in your git repo 13 days ago with this patch(you mentioned it above):
https://github.com/rdp/FFmpeg/commit/a5 ... d94ba.diff
That two combined gives us ffmpeg HDYC capture support via DirectShow for DeckLink HD resolutions.
Thank you for that and I am eager to see it in the official ffmpeg git :)
PS: What a coincidence :D
Last edited by iotzo on Tue Jan 29, 2013 12:09 am, edited 2 times in total.

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

Re: Include HDYC pixel format

Post by rogerdpack » Mon Jan 28, 2013 9:21 pm

iotzo wrote:Well :) I've just compiled the ffmpeg version from your git repo and it's working :)
Ok I sent those initial commits upstream, thanks for checking.

Could you also try it with this commit, see if it makes any difference color space wise?

https://github.com/rdp/FFmpeg/commit/47 ... f410a8bd5e

Basically you should be able to see "barely greys" now and also "near whites" should not all appear white. Good luck with this one! :)
-roger-

iotzo
Posts: 35
Joined: Thu Jan 24, 2013 4:49 pm

Re: Include HDYC pixel format

Post by iotzo » Mon Jan 28, 2013 11:36 pm

OK! This is the new build.

Code: Select all

F:\>ffmpeg_rdpnew.exe  -threads 4 -rtbufsize 512000k -framerate 25 -f dshow -video_size 1920x1080 -channels 2 -i video="Decklink Video Capture":audio="Decklink Audio Capture" -filter_complex "[a] channelsplit=channel_layout=2 [FL][FR]" -map v -map [FL] -map [FR] -vcodec mpeg2video -pix_fmt yuv422p -flags  +ildct+ilme -top 1  -b:v 50000k -minrate:v 50000k -maxrate:v 50000k  -bufsize:v 36408333 -bf 2 -rc_max_vbv_use 1 -rc_min_vbv_use 1 -dc 10 -qmin 1 -lmin "1*QP2LAMBDA" -intra_vlc 1 -acodec pcm_s24le  -y rdpnew.mxf
ffmpeg version N-49407-g47e8848-iotzo Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan 29 2013 00:55:29 with gcc 4.7.2 (GCC)
  configuration: --enable-static --arch=x86_64 --target-os=mingw32 --cross-prefix=/root/sandbox/mingw-w64-x86_64/bin/x86_64-w64-ming
w32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --enable-libmp3lame --enable-version3
--enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable
-libgsm --enable-libfreetype --enable-fontconfig --enable-libass --enable-libutvideo --enable-libopus --disable-w32threads --enable-
frei0r --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable-libop
encore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libbluray --enable-libvpx --extra-
version=iotzo --enable-runtime-cpudetect
  libavutil      52. 17.100 / 52. 17.100
  libavcodec     54. 91.100 / 54. 91.100
  libavformat    54. 61.104 / 54. 61.104
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 34.101 /  3. 34.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[dshow @ 0000000002001200] attempt use full range for HDYC...Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, dshow, from 'video=Decklink Video Capture:audio=Decklink Audio Capture':
  Duration: N/A, start: 0.093297, bitrate: 1536 kb/s
    Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 1920x1080, 25 tbr, 10000k tbn, 25 tbc
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Output #0, mxf, to 'rdpnew.mxf':
  Metadata:
    encoder         : Lavf54.61.104
    Stream #0:0: Video: mpeg2video, yuv422p, 1920x1080, q=1-31, 50000 kb/s, 25 tbn, 25 tbc
    Stream #0:1: Audio: pcm_s24le, 48000 Hz, 1 channels (FL), s32, 1152 kb/s
    Stream #0:2: Audio: pcm_s24le, 48000 Hz, 1 channels (FR), s32, 1152 kb/s
Stream mapping:
  Stream #0:1 (pcm_s16le) -> channelsplit (graph 0)
  Stream #0:0 -> #0:0 (rawvideo -> mpeg2video)
  channelsplit:FL (graph 0) -> Stream #0:1 (pcm_s24le)
  channelsplit:FR (graph 0) -> Stream #0:2 (pcm_s24le)
Press [q] to stop, [?] for help
frame=  458 fps= 25 q=1.0 Lsize=  117180kB time=00:00:18.29 bitrate=52484.4kbits/s
video:111659kB audio:5141kB subtitle:0 global headers:0kB muxing overhead 0.325008%
I'll see if I can check for black/white levels and color shifts these days.
10x!

iotzo
Posts: 35
Joined: Thu Jan 24, 2013 4:49 pm

Re: Include HDYC pixel format

Post by iotzo » Tue Jan 29, 2013 12:38 am

One more issue:
"unknown compression type 0x30313276"
I suppose this is v210? Can we handle it too via dshow:

Code: Select all

F:\>ffmpeg_rdpnew.exe -f dshow -list_options true -i video="Decklink Video Capture"
ffmpeg version N-49407-g47e8848-iotzo Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan 29 2013 00:55:29 with gcc 4.7.2 (GCC)
  configuration: --enable-static --arch=x86_64 --target-os=mingw32 --cross-prefix=/root/sandbox/mingw-w64-x86_64/bin/x86_64-w64-ming
w32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --enable-libmp3lame --enable-version3
--enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable
-libgsm --enable-libfreetype --enable-fontconfig --enable-libass --enable-libutvideo --enable-libopus --disable-w32threads --enable-
frei0r --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable-libop
encore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libbluray --enable-libvpx --extra-
version=iotzo --enable-runtime-cpudetect
  libavutil      52. 17.100 / 52. 17.100
  libavcodec     54. 91.100 / 54. 91.100
  libavformat    54. 61.104 / 54. 61.104
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 34.101 /  3. 34.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[dshow @ 00000000020ddfe0] DirectShow video device options
[dshow @ 00000000020ddfe0]  Pin "Capture"
[dshow @ 00000000020ddfe0]   pixel_format=uyvy422  min s=720x486 fps=29.97 max s=720x486 fps=29.97
[dshow @ 00000000020ddfe0]   pixel_format=uyvy422  min s=720x486 fps=23.976 max s=720x486 fps=23.976
[dshow @ 00000000020ddfe0]   pixel_format=uyvy422  min s=720x576 fps=25 max s=720x576 fps=25
[dshow @ 00000000020ddfe0]   pixel_format=uyvy422  min s=1920x1080 fps=23.976 max s=1920x1080 fps=23.976
[dshow @ 00000000020ddfe0]   pixel_format=uyvy422  min s=1920x1080 fps=24 max s=1920x1080 fps=24
[dshow @ 00000000020ddfe0]   pixel_format=uyvy422  min s=1920x1080 fps=25 max s=1920x1080 fps=25
[dshow @ 00000000020ddfe0]   pixel_format=uyvy422  min s=1920x1080 fps=29.97 max s=1920x1080 fps=29.97
[dshow @ 00000000020ddfe0]   pixel_format=uyvy422  min s=1920x1080 fps=30 max s=1920x1080 fps=30
[dshow @ 00000000020ddfe0]   pixel_format=uyvy422  min s=1280x720 fps=50 max s=1280x720 fps=50
[dshow @ 00000000020ddfe0]   pixel_format=uyvy422  min s=1280x720 fps=59.9402 max s=1280x720 fps=59.9402
[dshow @ 00000000020ddfe0]   pixel_format=uyvy422  min s=1280x720 fps=60.0002 max s=1280x720 fps=60.0002
[dshow @ 00000000020ddfe0]   unknown compression type 0x30313276  min s=720x486 fps=29.97 max s=720x486 fps=29.97
[dshow @ 00000000020ddfe0]   unknown compression type 0x30313276  min s=720x486 fps=23.976 max s=720x486 fps=23.976
[dshow @ 00000000020ddfe0]   unknown compression type 0x30313276  min s=720x576 fps=25 max s=720x576 fps=25
[dshow @ 00000000020ddfe0]   unknown compression type 0x30313276  min s=1920x1080 fps=23.976 max s=1920x1080 fps=23.976
[dshow @ 00000000020ddfe0]   unknown compression type 0x30313276  min s=1920x1080 fps=24 max s=1920x1080 fps=24
[dshow @ 00000000020ddfe0]   unknown compression type 0x30313276  min s=1920x1080 fps=25 max s=1920x1080 fps=25
[dshow @ 00000000020ddfe0]   unknown compression type 0x30313276  min s=1920x1080 fps=29.97 max s=1920x1080 fps=29.97
[dshow @ 00000000020ddfe0]   unknown compression type 0x30313276  min s=1920x1080 fps=30 max s=1920x1080 fps=30
[dshow @ 00000000020ddfe0]   unknown compression type 0x30313276  min s=1280x720 fps=50 max s=1280x720 fps=50
[dshow @ 00000000020ddfe0]   unknown compression type 0x30313276  min s=1280x720 fps=59.9402 max s=1280x720 fps=59.9402
[dshow @ 00000000020ddfe0]   unknown compression type 0x30313276  min s=1280x720 fps=60.0002 max s=1280x720 fps=60.0002
video=Decklink Video Capture: Immediate exit requested

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

Re: Include HDYC pixel format

Post by rogerdpack » Tue Jan 29, 2013 1:17 am

iotzo wrote:One more issue:
"unknown compression type 0x30313276"
I suppose this is v210?
Looks like it. It "should" be handled by the previous commits, maybe try them combined:
http://rogerdpack.t28.net/incoming/ffmp ... _latest.7z

Post Reply