Re: [FFmpeg-devel] [PATCH] libavdevice/decklink: 32 bit audio support

2017-10-20 Thread Douglas Marsh

On 2017-10-19 20:08, Douglas Marsh wrote:

On 2017-10-18 12:23, Dave Rice wrote:

[...]
Updated.

From 1e5ff78fec9b13eccac9a96acc358bbfd6a7015d Mon Sep 17 00:00:00 2001
From: Dave Rice <d...@dericed.com>
Date: Wed, 18 Oct 2017 15:21:46 -0400
Subject: [PATCH] libavdevice/decklink: 32 bit audio support



I (quickly before going to bed) did the following from commit: 
858db4b01fa2b55ee55056c033054ca54ac9b0fd


(documented the morning after, but believe this is correct)

Works:
$ ffmpeg10 -format_code Hp59 -f decklink -video_input hdmi -audio_input 
embedded -audio_depth 32 -raw_format argb -i 'DeckLink Studio 4K' -c:a 
pcm_s24le -vcodec libx264 -crf 0 -preset superfast test.mov
$ ffmpeg10 -format_code Hp59 -f decklink -video_input hdmi -audio_input 
embedded -audio_depth 32 -raw_format argb -i 'DeckLink Studio 4K' -c:a 
pcm_s32le -vcodec libx264 -crf 0 -preset superfast test.mkv
$ ffmpeg10 -format_code Hp59 -f decklink -video_input hdmi -audio_input 
embedded -audio_depth 32 -raw_format argb -i 'DeckLink Studio 4K' 
-acodec flac -vcodec libx264 -crf 0 -preset superfast test.mkv


Doesn't work (issues with MOV and 32-bit audio so assuming not a deal, 
unless 32-bit audio SHOULD work)
$ ffmpeg10 -format_code Hp59 -f decklink -video_input hdmi -audio_input 
embedded -audio_depth 32 -raw_format argb -i 'DeckLink Studio 4K' 
-acodec copy -vcodec libx264 -crf 0 -preset superfast test.mov
$ ffmpeg10 -format_code Hp59 -f decklink -video_input hdmi -audio_input 
embedded -audio_depth 32 -raw_format argb -i 'DeckLink Studio 4K' -c:a 
pcm_s32le -vcodec libx264 -crf 0 -preset superfast test.mov


Haven't tested rgb10 (assuming is "soft" fails [600.0fps*] or complains 
like in previous builds):
$ ffmpeg10 -format_code Hp59 -f decklink -video_input hdmi -audio_input 
embedded -audio_depth 32 -raw_format rgb10 -i 'DeckLink Studio 4K' -c:a 
copy -vcodec libx264 -crf 0 -preset superfast test.mkv


*=soft fails as in older builds getting a reported 600.0fps (I posted 
something here previous) when -c copy output.avi and analyze the avi 
file metadata


(side note)
Also works: (with v4l2loopback)
$ ffmpeg10 -format_code Hp59 -f decklink -video_input hdmi -audio_input 
embedded -audio_depth 32 -raw_format argb -i 'DeckLink Studio 4K' -c:a 
null -c:v rawvideo -pix_fmt yuv420p -threads 2 -f v4l2 /dev/videoX


(where ffmpeg10 = 
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/x264-10bit/libx264.so.148 ffmpeg 
"$@")


--Doug (dx9s)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavdevice/decklink: 32 bit audio support

2017-10-19 Thread Douglas Marsh

On 2017-10-19 20:08, Douglas Marsh wrote:


Is that a commit (1e5ff78fec9b13eccac9a96acc358bbfd6a7015d) I should
check out on my Decklink and try or is there another one I should try?

Will try to get to testing it this weekend.



Nevermind I found this:

* commit 89cc48551bbe9f147ba9f4ca3821a35797cf7b47
| Author: Dave Rice <d...@dericed.com>
| Date:   Wed Oct 18 15:21:46 2017 -0400
|
| avdevice/decklink_dec: 32 bit audio support
|
| Signed-off-by: Marton Balint <c...@passwd.hu>


I'll merge that with a local branch I forked for testing purposes 
(marking a known place for testing).


--Doug (dx9s)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavdevice/decklink: 32 bit audio support

2017-10-19 Thread Douglas Marsh

On 2017-10-18 12:23, Dave Rice wrote:

[...]
Updated.

From 1e5ff78fec9b13eccac9a96acc358bbfd6a7015d Mon Sep 17 00:00:00 2001
From: Dave Rice 
Date: Wed, 18 Oct 2017 15:21:46 -0400
Subject: [PATCH] libavdevice/decklink: 32 bit audio support



Is that a commit (1e5ff78fec9b13eccac9a96acc358bbfd6a7015d) I should 
check out on my Decklink and try or is there another one I should try?


Will try to get to testing it this weekend.

--Doug (dx9s)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] decklink 24/32 bit question

2017-10-18 Thread Douglas Marsh

On 2017-10-17 12:44, Devin Heitmueller wrote:


The decklink sdk only defines two BMDAudioSampleType values: 
bmdAudioSampleType16bitInteger and bmdAudioSampleType32bitInteger. I 
don't think there's an easy way to support a 24 bit input here. 
Generally in this case I've used bmdAudioSampleType32bitInteger and 
then encode it at pcm_s24le.

Dave Rice


For what it’s worth, I’ve got deinterleaving code in the works to
handle capture of multiple pairs of audio (i.e. break 16 channels into
8 pairs and announce them as separate S16LE streams).  If we really
thought 24-bit was desirable, that code could be adjusted accordingly
(the hardware would still capture 32-bit, but the deinterleaver would
put out S24LE).



I am not really sure I follow. I am not sure supporting 24-bit is a big 
issue. A sample size of 32-bit should work fine for most folks. I can 
only think of people (in the output stream) converting to 24-bits (via 
truncate or dither*) to save disk space or pre-processing for some other 
step [compression] (but video is really the bit-hog). I only mentioned 
24-bits because the ADC/DACs are mentioned at supporting PCM 24-bits 
natively meaning the PCI card is (assuming) padding the LSB (hence 
truncate is more logical for any conversion 32->24). AS for what comes 
in digitally over SDI or HDMI is too assumed to only support PCM 24-bits 
(but it is subject to standards that can update).


Making the workflow (stream capturing) of 32-bits is simpler, and moving 
any bit-depth conversion to the output stream side. Only concerns would 
be CPU processing (of which truncating bits is very fast and logical due 
to the assumed padding).


--Doug (dx9s)

*dither= I am not aware of any audio bit-depth dithering algorithms in 
FFMPEG, however it would make sense they do exist as this software is 
quite simply an amazing 'swiss-army knife'



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavdevice/decklink: 32 bit audio support

2017-10-17 Thread Douglas Marsh

On 2017-10-17 09:10, Dave Rice wrote:



 -audio_depth   .D.. audio bitdepth (from 0 to 
1)

(default 16bits)
16bits   .D..




Hmm, first patch might be enough.


Sounds good to me. Unless anyone prefers "-audio_depth thirtytwo" :-D
Dave Rice



Yeah that works.. so if they have any other depths, can go 0, 1 or 2 
(2=some new bit depth yet to be created)


And for clarification: yes 32-bits (PCM_S32LE) -- I was just pointing 
out the ADC/DAC's are 24-bit (8-bits padded).


--Doug (dx9s)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavdevice/decklink: 32 bit audio support

2017-10-17 Thread Douglas Marsh

On 2017-10-17 06:22, Dave Rice wrote:


I don't see there to be an AV_OPT_TYPE_ENUM. Could you point out how
this works from an example? Alternatively since the decklink sdk only
supports 2 bit depths (16 and 32), I could use a boolean here if that
makes more sense.
Dave Rice



I am unsure about the AV_OPT_TYPE_ENUM as well so can't answer that. I 
would not use a boolean, even tho the audio word/sample sizes will 
probably never change from those two offerings. As stated in previous 
recent message/thread, from what I know about my card, it only has a 
24-bit ADC/DAC for audio and the 16-bit modes are either truncated or 
dithered in hardware or drivers. They might come out with higher end 
hardware that captures 32-bits PCM at some later date, they will have an 
additional defined constant which would require converting the boolean 
back into an int what your patch currently has (int I believe it was).


I will try the patch out when I can as it is something I want for two 
reasons (higher quality and see if it solves an audio glitch that 
occasionally pops up during capture, difficult to reproduce -- happens 
with their reference capture software under Linux as well so think it is 
hardware issue with HDMI splitter I have).


--Doug (dx9s)


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] decklink 24/32 bit question

2017-10-17 Thread Douglas Marsh

On 2017-10-17 11:59, Moritz Barsnick wrote:


Did you check out Dave Rice's recent patch (on this list)? It touches
code in a few more places, and adds an option to select 16 vs. 32 bits.
Please test, if you can.

Is your subject indicating that 24 bits depth could also be supported?
If so, Dave perhaps should expand his patch to cover that.



I did see it!

Been busy, trying to get a video project done and under the belt before 
I start tinkering with dependent things. I *WILL* report back my 
experiences (positive or negative). I was hacking the source before that 
patch and see the two areas that I missed. But his patch added command 
line parameters for selecting (which I prefer). Was going to try it out 
and change the default to 32-bit as well.


I am guessing that some capture hardware may not support higher than 16 
bit depths? If all support higher depths, then why should the default 
not be higher and then let FFMPEG convert the input stream to the 
correct output stream (it might be 16 bits)? Is truncating CPU 
intensive? Dithering be applied? What does the DAC do in hardware when 
outputting 16-bits (truncate or dither)?


Also from what I understand word/sample size is 32-bits but the DAC is 
24 (assuming 8-bits are padded) -- hence why I said 24/32. I only see in 
the SDK 16-bits and 32-bits, but know the documentation for the card I 
have (Studio 4K) states 24-bits. Do others have cards that state 
anything additional over 16 and 32?


--Doug (dx9s)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] decklink 24/32 bit question

2017-10-03 Thread Douglas Marsh

After digging around in places, made the following changes:

dx@x299:~/git/ffmpeg$ git diff
diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index 3ce2cab..afd255f 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -937,7 +937,7 @@ av_cold int ff_decklink_read_header(AVFormatContext 
*avctx)

 goto error;
 }
 st->codecpar->codec_type  = AVMEDIA_TYPE_AUDIO;
-st->codecpar->codec_id= AV_CODEC_ID_PCM_S16LE;
+st->codecpar->codec_id= AV_CODEC_ID_PCM_S32LE;
 st->codecpar->sample_rate = bmdAudioSampleRate48kHz;
 st->codecpar->channels= cctx->audio_channels;
 avpriv_set_pts_info(st, 64, 1, 100);  /* 64 bits pts in us */
@@ -1028,7 +1028,7 @@ av_cold int 
ff_decklink_read_header(AVFormatContext *avctx)

 }

 av_log(avctx, AV_LOG_VERBOSE, "Using %d input audio channels\n", 
ctx->audio_st->codecpar->channels);
-result = ctx->dli->EnableAudioInput(bmdAudioSampleRate48kHz, 
bmdAudioSampleType16bitInteger, ctx->audio_st->codecpar->channels);
+result = ctx->dli->EnableAudioInput(bmdAudioSampleRate48kHz, 
bmdAudioSampleType32bitInteger, ctx->audio_st->codecpar->channels);


 if (result != S_OK) {
 av_log(avctx, AV_LOG_ERROR, "Cannot enable audio input\n");


It doesn't work (the audio capture is close but wrong), but believe it 
is a step in the correct direction. Anybody have a clue? Saw several 
names in cpp,c,h files including: Ramiro Polla, Luca Barbato, Deti 
Fliegl, Rafaël Carré and Akamai Technologies Inc.


Thanks in advance!

--Doug (dx9s)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] decklink rgb10 and 600.0fps ?!

2017-10-03 Thread Douglas Marsh


Has anybody tested and reported back success (no issues) with the recent 
decklink and rgb support added? In particular rgb10 mode.


I've have good luck in capturing from my 'DeckLink Studio 4K' only when 
RGB (can't seem to capture YUV, perhaps the HDMI data is only RGB -- 
still need to do testing with known YUV over HDMI as well)


-raw_format argb (and bgra) work and fairly well I will add!

-raw_format rgb10 does wierd things

(Sorry in advance for the long post, took most of the information out 
because I was told to not be s long)


dx@x299:~/storage/temp$ ffmpeg10 -format_code Hp59 -f decklink 
-video_input hdmi -audio_input embedded -raw_format rgb10 -i 'DeckLink 
Studio 4K' -acodec copy -vcodec copy -to 4 raw.avi

[...]

dx@x299:~/storage/temp$ mediainfo raw.avi
General
Complete name: raw.avi
Format   : AVI
Format/Info  : Audio Video Interleave
Format profile   : OpenDML
File size: 1.85 GiB
Duration : 4 s 4 ms
Overall bit rate : 3 979 Mb/s
Writing application  : Lavf57.82.102

Video
ID   : 0
Format   : YUV
Codec ID : R210
Codec ID/Info: BlackMagic YUV (Quick Time)
Duration : 4 s 3 ms
Bit rate : 3 978 Mb/s
Width: 1 920 pixels
Height   : 1 080 pixels
Display aspect ratio : 16:9
Frame rate   : 600.000 FPS
Color space  : YUV
Compression mode : Lossless
Bits/(Pixel*Frame)   : 3.198
Stream size  : 1.85 GiB (100%)

Audio
ID   : 1
Format   : PCM
Format settings  : Little / Signed
Format settings, Endianness  : Little
Format settings, Sign: Signed
Codec ID : 1
Duration : 4 s 4 ms
Bit rate mode: Constant
Bit rate : 1 536 kb/s
Channel(s)   : 2 channels
Sampling rate: 48.0 kHz
Bit depth: 16 bits
Stream size  : 751 KiB (0%)
Alignment: Aligned on interleaves
Interleave, duration : 17  ms (10.01 video frames)

dx@x299:~/storage/temp$ ffmpeg10 -i raw.avi -c:a copy -c:v libx264 -crf 
0 -preset ultrafast fromrawavi.mov
ffmpeg version N-87614-g3d4f8b9-dx9s-decklink Copyright (c) 2000-2017 
the FFmpeg developers

[...]

dx@x299:~/storage/temp$ mediainfo fromrawavi.mov
General
Complete name: fromrawavi.mov
Format   : MPEG-4
Format profile   : QuickTime
Codec ID : qt   .02 (qt  )
File size: 4.08 MiB
Duration : 4 s 4 ms
Overall bit rate : 8 548 kb/s
Writing application  : Lavf57.82.102

Video
ID   : 1
Format   : AVC
Format/Info  : Advanced Video Codec
Format profile   : High 4:4:4 Predictive@L5.2
Format settings  : 1 Ref Frames
Format settings, CABAC   : No
Format settings, RefFrames   : 1 frame
Codec ID : avc1
Codec ID/Info: Advanced Video Coding
Duration : 4 s 2 ms
Bit rate : 6 987 kb/s
Width: 1 920 pixels
Height   : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode  : Constant
Frame rate   : 600.000 FPS
Chroma subsampling   : 4:4:4
Bit depth: 10 bits
Scan type: Progressive
Bits/(Pixel*Frame)   : 0.006
Stream size  : 3.33 MiB (82%)
Writing library  : x264 core 148 r2643 5c65704
Encoding settings: cabac=0 / ref=1 / 
deblock=0:0:0 / analyse=0:0 / me=dia / subme=0 / psy=1 / 
psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 
8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=6 / 
threads=24 / lookahead_threads=4 /