audio channel manipulation

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

audio channel manipulation

Jim Shupert, Jr.-2
Friends,
I think I have a solution to my needs.
My purpose here is to share and ask if there is a better way to achieve
my goal.
I would be happy to the thoughts of others.
This matter of audio mapping , channel selection is something that i
wished I understood better.

Goal: capture from dbeta  the audio is 4 "track" . you can stand at the
deck and turn each of the 4 up or down - they are independent.
I wish to achieve a ffv1 avi where the audio is 4 streams each having 1
mono channel

why was I concerend about this?
If a file has 1 stream with 4 channels ( the org 4 "tracks" from tape)
and the 1st 2 channels are "good stuff" but the  4th channel is
something less wanted
Then when you play in vlc - you have no control -- the wanted and the
unwanted .
if it is in 4 streams you can pick which to hear.

My capture system captures 10bit unc mov video [0:0]  ( 4ch_test.mov )
and the 4 audio "tracks" are found in 1 stream as 4 channels [0:1.0 ,
0:1.1, 0:1.2, 0:1.3 ]

below please find my current means to make the ffv1 avi ( with 4 stream
1 chn )   and then use the ffv1 avi
to make a mp4 with 1 stream of audio holding 2 channels


I was unable to do what i wished with audio mapping ( -map / -map_channel  )


---------------------------:: make the ffv1 avi from the 10b mov  capture .
4s_b.avi

ffmpeg -i 4ch_test.mov -vcodec ffv1 -level 3 -coder 1 -pix_fmt
yuv422p10le -aspect 4:3 -g 1 \
  -filter_complex "[0:a]pan=mono|c0=c0[a0]; [0:a]pan=mono|c0=c1[a1];
[0:a]pan=mono|c0=c2[a2]; [0:a]pan=mono|c0=c3[a3]" \
  -map 0:v -map "[a0]" -map "[a1]" -map "[a2]" -map "[a3]" -map 0:d -c
copy -c:a pcm_s24le -f avi 4s_b.avi

-----------------------:: make a mp4 (4s_b.mp4 ) from the ffv1 avi (
4s_b.avi )

ffmpeg -i 4s_b.avi -vf "yadif" -aspect 4:3 -vcodec libx264 -b:v 5110k -g
12 -bf 3 -b_strategy 1 -coder 1 \
  -qmin 10 -qmax 51 -sc_threshold 40 -me_range 16 -me_method hex -subq 5
-i_qfactor 0.71 -qcomp 0.6 -qdiff 4  -pix_fmt yuv420p \
  -filter_complex "[0:1] [0:2] amerge" -acodec aac -ar 48000 -b:a 256k
-ac 2 4s_b.mp4



::: the below are some mediainfo probes of the files
1- the capture from tape 2- the ffv1 avi I make , 3 the mp4 that i make
from the ffv1 avi

my capture 10b unc mov  4 channels in 1 stream
-----------------------:  org capture from tape
Video
ID                                       : 1
Format                                   : YUV
Codec ID                                 : v210
Codec ID/Hint                            : AJA Video Systems Xena
Duration                                 : 12 s 880 ms
Bit rate mode                            : Constant
Bit rate                                 : 224 Mb/s
Width                                    : 720 pixels
Height                                   : 486 pixels
Display aspect ratio                     : 4:3
Frame rate mode                          : Constant
Frame rate                               : 29.970 (30000/1001) FPS
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:2
Bit depth                                : 10 bits
Scan type                                : Interlaced
Scan type, store method                  : Interleaved fields
Scan order                               : Bottom Field First
Compression mode                         : Lossless
Bits/(Pixel*Frame)                       : 21.333
Stream size                              : 343 MiB (98%)
Language                                 : English
Encoded date                             : UTC 2019-01-15 22:54:36
Tagged date                              : UTC 2019-01-15 22:54:49
Color primaries                          : BT.601 NTSC
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.601

Audio
ID                                       : 2
Format                                   : PCM
Format settings, Endianness              : Little
Format settings, Sign                    : Signed
Codec ID                                 : lpcm
Duration                                 : 12 s 880 ms
Bit rate mode                            : Constant
Bit rate                                 : 4 608 kb/s
Channel(s)                               : 4 channels
Sampling rate                            : 48.0 kHz
Bit depth                                : 24 bits
Stream size                              : 7.07 MiB (2%)
Language                                 : English


that is turned into the ffv1 avi with 4 streams of audio with 1 channel each
-------------------------------------::  ffv1 avi now with 4 streams
each having 1 channel each
4s_b.avi
Format                                   : AVI
Format/Info                              : Audio Video Interleave
File size                                : 351 MiB
Duration                                 : 12 s 880 ms
Overall bit rate                         : 228 Mb/s
Writing application                      : Lavf57.83.100

Video
ID                                       : 0
Format                                   : YUV
Codec ID                                 : v210
Codec ID/Hint                            : AJA Video Systems Xena
Duration                                 : 12 s 880 ms
Bit rate                                 : 224 Mb/s
Width                                    : 720 pixels
Height                                   : 486 pixels
Display aspect ratio                     : 4:3
Frame rate                               : 59.940 (60000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:2
Bit depth                                : 10 bits
Scan type                                : Progressive
Compression mode                         : Lossless
Bits/(Pixel*Frame)                       : 10.667
Stream size                              : 343 MiB (98%)

Audio #1
ID                                       : 1
Format                                   : PCM
Format settings, Endianness              : Little
Format settings, Sign                    : Signed
Codec ID                                 :
00001000-0000-0100-8000-00AA00389B71
Duration                                 : 12 s 880 ms
Bit rate mode                            : Constant
Bit rate                                 : 1 152 kb/s
Channel(s)                               : 1 channel
Channel positions                        : Front: C
Sampling rate                            : 48.0 kHz
Bit depth                                : 24 bits
Stream size                              : 1.77 MiB (1%)
Alignment                                : Aligned on interleaves
Interleave, duration                     : 21  ms (1.27 video frame)

Audio #2
ID                                       : 2
Format                                   : PCM
Format settings, Endianness              : Little
Format settings, Sign                    : Signed
Codec ID                                 :
00001000-0000-0100-8000-00AA00389B71
Duration                                 : 12 s 880 ms
Bit rate mode                            : Constant
Bit rate                                 : 1 152 kb/s
Channel(s)                               : 1 channel
Channel positions                        : Front: C
Sampling rate                            : 48.0 kHz
Bit depth                                : 24 bits
Stream size                              : 1.77 MiB (1%)
Alignment                                : Aligned on interleaves
Interleave, duration                     : 21  ms (1.27 video frame)

Audio #3
ID                                       : 3
Format                                   : PCM
Format settings, Endianness              : Little
Format settings, Sign                    : Signed
Codec ID                                 :
00001000-0000-0100-8000-00AA00389B71
Duration                                 : 12 s 880 ms
Bit rate mode                            : Constant
Bit rate                                 : 1 152 kb/s
Channel(s)                               : 1 channel
Channel positions                        : Front: C
Sampling rate                            : 48.0 kHz
Bit depth                                : 24 bits
Stream size                              : 1.77 MiB (1%)
Alignment                                : Aligned on interleaves
Interleave, duration                     : 21  ms (1.27 video frame)

Audio #4
ID                                       : 4
Format                                   : PCM
Format settings, Endianness              : Little
Format settings, Sign                    : Signed
Codec ID                                 :
00001000-0000-0100-8000-00AA00389B71
Duration                                 : 12 s 880 ms
Bit rate mode                            : Constant
Bit rate                                 : 1 152 kb/s
Channel(s)                               : 1 channel
Channel positions                        : Front: C
Sampling rate                            : 48.0 kHz
Bit depth                                : 24 bits
Stream size                              : 1.77 MiB (1%)
Alignment                                : Aligned on interleaves
Interleave, duration                     : 21  ms (1.27 video frame

..........................................................:: the mp4

and now the mp4 made from the ffv1 avi
mp4 has 1 stream with 2 channels  and these are from the 1st 2 channels
or tape "tracks" 1 & 2

4s_b.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 3.05 MiB
Duration                                 : 12 s 901 ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 1 983 kb/s
Encoded date                             : UTC 1904-01-01 00:00:00
Tagged date                              : UTC 1904-01-01 00:00:00
Writing application                      : Lavf57.83.100

Video
ID                                       : 2
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Format settings, GOP                     : M=4, N=12
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 12 s 863 ms
Bit rate                                 : 1 914 kb/s
Nominal bit rate                         : 5 110 kb/s
Width                                    : 720 pixels
Height                                   : 486 pixels
Display aspect ratio                     : 4:3
Frame rate mode                          : Constant
Frame rate                               : 59.940 (60000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0

Audio
ID                                       : 1
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : 40
Duration                                 : 12 s 901 ms
Duration_LastFrame                       : -6 ms
Bit rate mode                            : Variable
Bit rate                                 : 60.8 kb/s
Maximum bit rate                         : 256 kb/s
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 spf)
Compression mode                         : Lossy
Stream size                              : 95.7 KiB (3%)


==================================================

Links that I used to further my understanding

https://www.markkeller.me/2016-11-27-ffmpeg/
https://ffmpeg.org/ffmpeg.html#Audio-Options

https://trac.ffmpeg.org/wiki/AudioChannelManipulation
https://superuser.com/questions/1063185/how-to-select-the-left-audio-channel-with-ffmpeg-and-downmix-to-mono

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: audio channel manipulation

Moritz Barsnick
On Mon, Jan 21, 2019 at 14:01:52 -0500, Jim Shupert wrote:
> if it is in 4 streams you can pick which to hear.
>
> My capture system captures 10bit unc mov video [0:0]  ( 4ch_test.mov )
> and the 4 audio "tracks" are found in 1 stream as 4 channels [0:1.0 ,
> 0:1.1, 0:1.2, 0:1.3 ]
[...]

Do you need the intermediate file 4s_b.avi? (I assume so, but your
final file 4s_b.mp4 can be created in one step, if that is desired.)

> ---------------------------:: make the ffv1 avi from the 10b mov  capture .
> 4s_b.avi
>
> ffmpeg -i 4ch_test.mov -vcodec ffv1 -level 3 -coder 1 -pix_fmt
> yuv422p10le -aspect 4:3 -g 1 \
>   -filter_complex "[0:a]pan=mono|c0=c0[a0]; [0:a]pan=mono|c0=c1[a1];
> [0:a]pan=mono|c0=c2[a2]; [0:a]pan=mono|c0=c3[a3]" \
>   -map 0:v -map "[a0]" -map "[a1]" -map "[a2]" -map "[a3]" -map 0:d -c
> copy -c:a pcm_s24le -f avi 4s_b.avi

Your filter
  "[0:a]pan=mono|c0=c0[a0]; [0:a]pan=mono|c0=c1[a1]; [0:a]pan=mono|c0=c2[a2]; [0:a]pan=mono|c0=c3[a3]"
is indeed a neat trick to separate your channels into streams. There's
an easier way though: The "channelsplit" filter:
https://ffmpeg.org/ffmpeg-filters.html#channelsplit

The second filter ("[0:1] [0:2] amerge") is just fine for creating
stereo from two separate channels.

> https://trac.ffmpeg.org/wiki/AudioChannelManipulation

Apparently, you read the section "stereo → 2 × mono files". My
suggestion with the "channelsplit" is right below, in the section
"stereo → 2 × mono streams". Actually, both filters will work either
way, the examples are quite arbitrary, come to think of it.

Cheers,
Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: audio channel manipulation

Jim Shupert, Jr.-2
On 1/21/2019 2:45 PM, Moritz Barsnick wrote:

> On Mon, Jan 21, 2019 at 14:01:52 -0500, Jim Shupert wrote:
>> if it is in 4 streams you can pick which to hear.
>>
>> My capture system captures 10bit unc mov video [0:0]  ( 4ch_test.mov )
>> and the 4 audio "tracks" are found in 1 stream as 4 channels [0:1.0 ,
>> 0:1.1, 0:1.2, 0:1.3 ]
> [...]
>
> Do you need the intermediate file 4s_b.avi? (I assume so, but your
> final file 4s_b.mp4 can be created in one step, if that is desired.)

Yes - both the ffv1 avi [ 4s_b.avi ] & the mp4 are the goal , the need.
the original   capture mov [ 4ch_test.mov ]  is very simply what I am
"able" to make via my hardware
which is a blackmagic card running media express. That is I can capture
all 4 "tracks"  but only & always into 1 stream with 4 channels

>
>> ---------------------------:: make the ffv1 avi from the 10b mov  capture .
>> 4s_b.avi
>>
>> ffmpeg -i 4ch_test.mov -vcodec ffv1 -level 3 -coder 1 -pix_fmt
>> yuv422p10le -aspect 4:3 -g 1 \
>>    -filter_complex "[0:a]pan=mono|c0=c0[a0]; [0:a]pan=mono|c0=c1[a1];
>> [0:a]pan=mono|c0=c2[a2]; [0:a]pan=mono|c0=c3[a3]" \
>>    -map 0:v -map "[a0]" -map "[a1]" -map "[a2]" -map "[a3]" -map 0:d -c
>> copy -c:a pcm_s24le -f avi 4s_b.avi
> Your filter
>    "[0:a]pan=mono|c0=c0[a0]; [0:a]pan=mono|c0=c1[a1]; [0:a]pan=mono|c0=c2[a2]; [0:a]pan=mono|c0=c3[a3]"
> is indeed a neat trick to separate your channels into streams. There's
> an easier way though: The "channelsplit" filter:
> https://ffmpeg.org/ffmpeg-filters.html#channelsplit
>
> The second filter ("[0:1] [0:2] amerge") is just fine for creating
> stereo from two separate channels.

ahhhh :: an   "an easier way"   wonderful -- in truth I often find there
are many "ways" ... i tend to keep using "one" after I find it works.
Thank you...expanding my understanding is what i am after
>
>> https://trac.ffmpeg.org/wiki/AudioChannelManipulation
> Apparently, you read the section "stereo → 2 × mono files". My
> suggestion with the "channelsplit" is right below, in the section
> "stereo → 2 × mono streams". Actually, both filters will work either
> way, the examples are quite arbitrary, come to think of it.
>


will do -- thanks again

and-- if anyone else has anyThing else to offer ... i am still anxious
to learn more
:)

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: audio channel manipulation

andrei ka
interesting, looks like ffv1 did zero compression here, stream size of .mov
& ffv1 avi is the same. or the file size changed, it's only mediainfo
computed decompressed stream size ?


On Mon, Jan 21, 2019 at 10:11 PM Jim Shupert <[hidden email]>
wrote:

> On 1/21/2019 2:45 PM, Moritz Barsnick wrote:
> > On Mon, Jan 21, 2019 at 14:01:52 -0500, Jim Shupert wrote:
> >> if it is in 4 streams you can pick which to hear.
> >>
> >> My capture system captures 10bit unc mov video [0:0]  ( 4ch_test.mov )
> >> and the 4 audio "tracks" are found in 1 stream as 4 channels [0:1.0 ,
> >> 0:1.1, 0:1.2, 0:1.3 ]
> > [...]
> >
> > Do you need the intermediate file 4s_b.avi? (I assume so, but your
> > final file 4s_b.mp4 can be created in one step, if that is desired.)
>
> Yes - both the ffv1 avi [ 4s_b.avi ] & the mp4 are the goal , the need.
> the original   capture mov [ 4ch_test.mov ]  is very simply what I am
> "able" to make via my hardware
> which is a blackmagic card running media express. That is I can capture
> all 4 "tracks"  but only & always into 1 stream with 4 channels
> >
> >> ---------------------------:: make the ffv1 avi from the 10b mov
> capture .
> >> 4s_b.avi
> >>
> >> ffmpeg -i 4ch_test.mov -vcodec ffv1 -level 3 -coder 1 -pix_fmt
> >> yuv422p10le -aspect 4:3 -g 1 \
> >>    -filter_complex "[0:a]pan=mono|c0=c0[a0]; [0:a]pan=mono|c0=c1[a1];
> >> [0:a]pan=mono|c0=c2[a2]; [0:a]pan=mono|c0=c3[a3]" \
> >>    -map 0:v -map "[a0]" -map "[a1]" -map "[a2]" -map "[a3]" -map 0:d -c
> >> copy -c:a pcm_s24le -f avi 4s_b.avi
> > Your filter
> >    "[0:a]pan=mono|c0=c0[a0]; [0:a]pan=mono|c0=c1[a1];
> [0:a]pan=mono|c0=c2[a2]; [0:a]pan=mono|c0=c3[a3]"
> > is indeed a neat trick to separate your channels into streams. There's
> > an easier way though: The "channelsplit" filter:
> > https://ffmpeg.org/ffmpeg-filters.html#channelsplit
> >
> > The second filter ("[0:1] [0:2] amerge") is just fine for creating
> > stereo from two separate channels.
>
> ahhhh :: an   "an easier way"   wonderful -- in truth I often find there
> are many "ways" ... i tend to keep using "one" after I find it works.
> Thank you...expanding my understanding is what i am after
> >
> >> https://trac.ffmpeg.org/wiki/AudioChannelManipulation
> > Apparently, you read the section "stereo → 2 × mono files". My
> > suggestion with the "channelsplit" is right below, in the section
> > "stereo → 2 × mono streams". Actually, both filters will work either
> > way, the examples are quite arbitrary, come to think of it.
> >
>
>
> will do -- thanks again
>
> and-- if anyone else has anyThing else to offer ... i am still anxious
> to learn more
> :)
>
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: audio channel manipulation

Moritz Barsnick
On Tue, Jan 22, 2019 at 11:09:50 +0100, andrei ka wrote:
> interesting, looks like ffv1 did zero compression here, stream size of .mov
> & ffv1 avi is the same. or the file size changed, it's only mediainfo
> computed decompressed stream size ?

Good observation. Not only is the size identical to the original, but
also the codec. ;-) What Jim erroneously did was to use the command
line options "-c copy -c:a pcm_s24le" *after* "-vcodec ffv1" - which
implies that the video is copied.

Jim, you need to reorder those options, or drop "-c copy", to achieve
what you desired.

Cheers,
Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: audio channel manipulation

Jim Shupert, Jr.-2
On 1/22/2019 8:03 AM, Moritz Barsnick wrote:

> On Tue, Jan 22, 2019 at 11:09:50 +0100, andrei ka wrote:
>> interesting, looks like ffv1 did zero compression here, stream size of .mov
>> & ffv1 avi is the same. or the file size changed, it's only mediainfo
>> computed decompressed stream size ?
> Good observation. Not only is the size identical to the original, but
> also the codec. ;-) What Jim erroneously did was to use the command
> line options "-c copy -c:a pcm_s24le" *after* "-vcodec ffv1" - which
> implies that the video is copied.
>
> Jim, you need to reorder those options, or drop "-c copy", to achieve
> what you desired.
oh dear -- thatz on me!
      so much focus on the audio , so little attention to the video
      did/// -c copy -c:a pcm_s24le
      meant to only copy the audio/// |-c:a copy
< i wear the red face >
|thanks yall !  ----------( I LOVE YOU FOLKS )


_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".