Interleaving into AC3

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Interleaving into AC3

jpoet
While working on adding multi-channel audio support to gstdecklinkaudiosrc, I tried to come up with a pipeline which throws away all but the first six channels, and encodes them into AC3.  The following pipeline works:

```
gst-launch-1.0 decklinkvideosrc device-number=${DEVICE} mode=0 ! fakesink \
   decklinkaudiosrc device-number=${DEVICE} audio-channels=8 ! audioconvert ! \
   deinterleave name=d  interleave name=i ! audioconvert ! "audio/x-raw,channels=6" ! \
   wavenc ! wavparse ! audioconvert ! avenc_ac3 bitrate=640000 ! queue ! ac3parse ! \
   filesink location=dest.wav   \
   d.src_0 ! queue ! audioconvert ! i.sink_0   \
   d.src_1 ! queue ! audioconvert ! i.sink_1   \
   d.src_2 ! queue ! audioconvert ! i.sink_2   \
   d.src_3 ! queue ! audioconvert ! i.sink_3   \
   d.src_4 ! queue ! audioconvert ! i.sink_4   \
   d.src_5 ! queue ! audioconvert ! i.sink_5

```

I would like to understand why the `wavenc ! wavparse` is necessary, though.  Without that extra conversion step, I get:

```
ERROR: from element /GstPipeline:pipeline0/GstDecklinkAudioSrc:decklinkaudiosrc0: Internal data stream error.

```

I also discovered that trying to remap the channels also fails with a message like:

```
could not link audioconvert8 to i
```

and it fails exactly the same way.  Is this a regression?

For the end result, I want a transport stream.  PCM is not allowed in a TS, so AC3 seems like the best choice.  However, avenc_ac3 only accepts 6 channels.   If my SDI source has more than 6 channels, it will be "secondary" audio anyway, so having a second (or more) AC3 track should be fine.

Thank you for any insight.

John




_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Interleaving into AC3

Tim Müller
On Thu, 2016-09-15 at 23:48 +0000, John P Poet wrote:

Hi John,

> While working on adding multi-channel audio support to
> gstdecklinkaudiosrc, I tried to come up with a pipeline which throws
> away all but the first six channels, and encodes them into AC3.  The
> following pipeline works:
>  (snip)

> I would like to understand why the `wavenc ! wavparse` is necessary,
> though.  Without that extra conversion step, I get (an error).

I haven't tried any of your pipelines, but my guess is that it's got to
do with channel positioning ("channel-mask" field in the raw audio
caps). decklinkaudiosrc probably outputs channel-mask=0 meaning all
channels are unpositioned, but the AC3 encoder likely wants positioned
channels. wavenc ! wavparse might work around this by accident more
than by design by assigning a default channel mask for 6 channels when
none is set in the headers, thus making the encoder happy.

You should be able to achieve the same effect either

 - by setting the "channel-positions" property on interleave from code
(this won't work with gst-launch-1.0)

 - by setting a channel position (channel-mask in the caps) on each
input channel to the interleave, then it will/should pick up the
positions and interleave them appropriately (hopefully).

Cheers
 -Tim

--
Tim Müller, Centricular Ltd - http://www.centricular.com

Join us at the GStreamer Conference!
10-11 October 2016 in Berlin,
Germany
http://gstreamer.freedesktop.org/conference/

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel