<div dir="ltr">On Wed, Aug 31, 2016 at 1:00 AM Sebastian Dröge <<a href="mailto:sebastian@centricular.com">sebastian@centricular.com</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Tue, 2016-08-30 at 19:41 +0000, John P Poet wrote:<br>
> On Tue, Aug 30, 2016 at 12:42 AM Sebastian Dröge <<a href="mailto:sebastian@centricular.com" target="_blank">sebastian@centricular.com</a>> wrote:<br>
> > On Mon, 2016-08-29 at 21:03 +0000, John P Poet wrote:<br>
> > > I noticed that support for 8 and 16 channel audio was added to<br>
> > > decklinkaudiosink. Are there any plans to support to<br>
> > > decklinkaudiosrc as well?<br>
> > ><br>
> > > I came across <a href="https://bugzilla.gnome.org/attachment.cgi?id=274910&act" rel="noreferrer" target="_blank">https://bugzilla.gnome.org/attachment.cgi?id=274910&act</a><br>
> > > ion=diff , but that is quite old. I have not even tried to apply it.<br>
> ><br>
> > It does not apply anymore and needs a major update.<br>
> ><br>
> > Adding support for 8 and 16 channels is relatively simple and can be<br>
> > done similar to what that patch does, however decklink does not provide<br>
> > any information about the location/layout of channels and as such we<br>
> > would have to handle it as unpositioned.<br>
> ><br>
> > Do you want to update the patch?<br>
><br>
> I am willing to try. I have hacked on other peoples code a little bit, when necessary, but do not have a high degree of comfort when working on GStreamer internals.<br>
><br>
> Is there some other src module I can use as an example? Searching for similar code, I see: <br>
><br>
> gst-plugins-bad/ext/flite/gstflitetestsrc.c<br>
> gst-plugins-base/gst/audioconvert/gstaudioconvert.c<br>
><br>
> Based on those two, I am guessing I need to create a "fixate" function. I need to understand how the caps are managed...<br>
<br>
You would need to:<br>
1) Add 8 / 16 channels to the template caps like in the audio <br>
2) Handle those in gst_decklink_audio_src_set_caps() (EnableAudioInput)<br>
3) Check what the hardware actually supports and do something like<br>
in gst_decklink_audio_sink_get_caps()<br>
4) Implement fixate to select a meaningful number of channels if<br>
you still get multiple in there. 2 seems like the best choice<br>
as we know the channel layout for that<br>
<br>
In general for 8 / 16 channels, the channel-mask in the caps would be<br>
0, which means unpositioned.<br>
<br>
--<br>
Sebastian Dröge, Centricular Ltd · <a href="http://www.centricular.com" rel="noreferrer" target="_blank">http://www.centricular.com</a><br></blockquote><div><br></div><div>Hi Sebastian,<br><br></div><div>I am attaching my attempt at this. Unfortunately it does not quite work. I cannot figure out how to get 8 channels of audio encoded into ac3. With this pipeline:<br><br>```<br><span style="font-family:monospace">gst-launch-1.0 decklinkvideosrc device-number=${DEVICE} mode=0 ! queue ! autovideoconvert ! deinterlace mode=2 ! queue ! avenc_mpeg2video bitrate=800000 ! mpegvideoparse ! mpegtsmux name=mux ! filesink location=video.ts decklinkaudiosrc device-number=${DEVICE} audio-channels=8 ! audioconvert ! avenc_ac3 bitrate=640000 ! ac3parse ! queue ! mux.</span><br>```<br><br></div><div>The resulting file has:<br>```<br><span style="font-family:monospace">Audio<br>ID : 66 (0x42)<br>Menu ID : 1 (0x1)<br>Format : AC-3<br>Format/Info : Audio Coding 3<br>Mode extension : CM (complete main)<br>Format settings, Endianness : Big<br>Codec ID : 129<br>Duration : 3s 485ms<br>Bit rate mode : Constant<br>Bit rate : 640 Kbps<br>Channel(s) : 1 channel<br>Channel positions : Front: C<br>Sampling rate : 48.0 KHz<br>Bit depth : 16 bits<br>Compression mode : Lossy<br>Stream size : 272 KiB (15%)<br>Language : English</span><br>```<br><br></div><div>I have read that the audio from the Decklink is single-track, mult-channel PCM. I thought maybe I needed to deinterlace it for the ac3 encoder to process it correctly, so I tried:<br>```<br> <span style="font-family:monospace">gst-launch-1.0 decklinkvideosrc device-number=${DEVICE} mode=0 ! queue ! autovideoconvert ! deinterlace mode=2 ! queue ! avenc_mpeg2video bitrate=800000 ! mpegvideoparse ! mpegtsmux name=mux ! filesink location=video.ts decklinkaudiosrc device-number=${DEVICE} audio-channels=8 ! audioconvert ! "audio/x-raw,channels=8" ! deinterleave ! audioconvert ! avenc_ac3 bitrate=640000 ! ac3parse ! queue ! mux.</span><br>```<br></div><div>But either that pipeline is incorrect for that purpose, or it just doesn't help.<br><br></div><div>I built and ran <a href="https://github.com/lu-zero/bmdtools/blob/master/bmdcapture.cpp">https://github.com/lu-zero/bmdtools/blob/master/bmdcapture.cpp</a> , and it produces 8 channel PCM audio. As far as I can tell, that code is not doing any conversion, it just is writing the PCM audio straight from the Decklink card/driver.<br><br></div><div>I tried coming up with a pipeline which does not convert the audio, but was unsuccessful. <br></div><div><br></div><div>I also found the patch that added 8/16 channel support to ffmpeg: <a href="https://ffmpeg.org/pipermail/ffmpeg-devel/2015-January/167444.html">https://ffmpeg.org/pipermail/ffmpeg-devel/2015-January/167444.html</a><br><br></div><div>but it does not really shed any light on the situation.<br><br></div><div>Note: If I set the channel mask to zero, then those pipelines don't run at all.<br><br></div><div>Any help would be appreciated.<br><br></div><div>Thanks,<br><br></div><div>John<br><br></div><div><br><br></div></div></div>