Creating surround sound from mono wav files

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

Creating surround sound from mono wav files

CherylJosie
Hi all,
I am trying to merge a surround sound file from discrete mono files with ffmpeg.
The -map_channel function does not accept multiple audio input streams, and so far I have only managed to create stereo with -filter_complex amerge.
amerge seems to ignore additional channels beyond stereo at the output, even though it parses them as inputs.

Apologies for my lack of expertise. I've only used ffmpeg and Linux for simple things (scripted IC design workflows mainly), and despite my engineering background I'm not a recording engineer.
I'm running
$ ffmpeg -i Front\ Left.wav -i Front\ Right.wav -i Front\ Center.wav -i Rear\ Left.wav -i Rear\ Right.wav -i Surround\ Left.wav -i Surround\ Right.wav -filter_complex amerge out.wavffmpeg version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
  configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Guessed Channel Layout for  Input Stream #0.0 : mono
Input #0, wav, from 'Front Left.wav':
  Duration: 03:40:20.06, bitrate: 768 kb/s
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 1 channels, s16, 768 kb/s
Guessed Channel Layout for  Input Stream #1.0 : mono
Input #1, wav, from 'Front Right.wav':
  Duration: 03:40:20.06, bitrate: 768 kb/s
    Stream #1:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 1 channels, s16, 768 kb/s
Guessed Channel Layout for  Input Stream #2.0 : mono
Input #2, wav, from 'Front Center.wav':
  Duration: 03:40:20.06, bitrate: 768 kb/s
    Stream #2:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 1 channels, s16, 768 kb/s
Guessed Channel Layout for  Input Stream #3.0 : mono
Input #3, wav, from 'Rear Left.wav':
  Duration: 03:40:20.06, bitrate: 768 kb/s
    Stream #3:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 1 channels, s16, 768 kb/s
Guessed Channel Layout for  Input Stream #4.0 : mono
Input #4, wav, from 'Rear Right.wav':
  Duration: 03:40:20.06, bitrate: 768 kb/s
    Stream #4:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 1 channels, s16, 768 kb/s
Guessed Channel Layout for  Input Stream #5.0 : mono
Input #5, wav, from 'Surround Left.wav':
  Duration: 03:40:20.06, bitrate: 768 kb/s
    Stream #5:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 1 channels, s16, 768 kb/s
Guessed Channel Layout for  Input Stream #6.0 : mono
Input #6, wav, from 'Surround Right.wav':
  Duration: 03:40:20.06, bitrate: 768 kb/s
    Stream #6:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 1 channels, s16, 768 kb/s
[Parsed_amerge_0 @ 0x23ba960] No channel layout for input 1
[Parsed_amerge_0 @ 0x23ba960] Input channel layouts overlap: output layout will be determined by the number of distinct input channels
Output #0, wav, to 'out.wav':
  Metadata:
    ISFT            : Lavf56.40.101
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      encoder         : Lavc56.60.100 pcm_s16le
Stream mapping:
  Stream #0:0 (pcm_s16le) -> amerge:in0
  Stream #1:0 (pcm_s16le) -> amerge:in1
  amerge -> Stream #0:0 (pcm_s16le)
Press [q] to stop, [?] for help
size= 2478762kB time=03:40:20.06 bitrate=1536.0kbits/s   
video:0kB audio:2478762kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000003%

and the resulting file is
$ mediainfo out.wavGeneral
Complete name                            : out.wav
Format                                   : Wave
File size                                : 2.36 GiB
Duration                                 : 3h 40mn
Overall bit rate mode                    : Constant
Overall bit rate                         : 1 536 Kbps
Writing application                      : Lavf56.40.101

Audio
Format                                   : PCM
Format settings, Endianness              : Little
Format settings, Sign                    : Signed
Codec ID                                 : 1
Duration                                 : 3h 40mn
Bit rate mode                            : Constant
Bit rate                                 : 1 536 Kbps
Channel(s)                               : 2 channels
Sampling rate                            : 48.0 KHz
Bit depth                                : 16 bits
Stream size                              : 2.36 GiB (100%)
on
$ uname -a
Linux media1-AX370-Gaming-5 4.4.0-139-generic #165-Ubuntu SMP Wed Oct 24 10:58:50 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

The output is stereo of the first two channels only regardless of how many additional channels are given as inputs. I tried both 7 and 8 inputs and the resulting file was stereo.

This project is on a shoestring budget. I'm attempting to do it all with open-source software because it's all I have access to.

Thanks.Cheryl
_______________________________________________
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: Creating surround sound from mono wav files

Paul B Mahol
On 12/23/18, CherylJosie <[hidden email]> wrote:
> Hi all,
> I am trying to merge a surround sound file from discrete mono files with
> ffmpeg.
> The -map_channel function does not accept multiple audio input streams, and
> so far I have only managed to create stereo with -filter_complex amerge.
> amerge seems to ignore additional channels beyond stereo at the output, even
> though it parses them as inputs.

It does not parses them all.
Read manual and you will notice that amerge needs option that set
number of inputs.
_______________________________________________
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: Creating surround sound from mono wav files

CherylJosie
Yes thanks found a helpful site and got that far just after posting but I found the info on number of channels online not in the ffmpeg manual. I wasn't even sure what to look for so couldn't search the manual with a direct query.

I'm trying to do 7.0 but it's generating 6.1. I'll keep looking for the channel configuration instruction too i guess. I could maybe add a blank LFE if I knew the syntax. Syntax seems different for avlib than for ffmpeg and amerge is an avlib function apparently?
Sorry really new at this av processing. Thanks again for the tip. I'll keep looking. Getting there.
      From: Paul B Mahol <[hidden email]>
 To: FFmpeg user questions <[hidden email]>
 Sent: Sunday, December 23, 2018 12:59 PM
 Subject: Re: [FFmpeg-user] Creating surround sound from mono wav files
   
On 12/23/18, CherylJosie <[hidden email]> wrote:
> Hi all,
> I am trying to merge a surround sound file from discrete mono files with
> ffmpeg.
> The -map_channel function does not accept multiple audio input streams, and
> so far I have only managed to create stereo with -filter_complex amerge.
> amerge seems to ignore additional channels beyond stereo at the output, even
> though it parses them as inputs.

It does not parses them all.
Read manual and you will notice that amerge needs option that set
number of inputs.
_______________________________________________
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: Creating surround sound from mono wav files

Moritz Barsnick
On Sun, Dec 23, 2018 at 23:22:38 +0000, CherylJosie wrote:

> Yes thanks found a helpful site and got that far just after posting
> but I found the info on number of channels online not in the ffmpeg
> manual. I wasn't even sure what to look for so couldn't search the
> manual with a direct query.

Just by looking at the documentation for the amerge filter:

https://ffmpeg.org/ffmpeg-filters.html#amerge-1

This wiki page is also very practical, by the way:

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

> I'm trying to do 7.0 but it's generating 6.1. I'll keep looking for the channel configuration instruction too i guess.

I believe ffmpeg is guessing the channel layout. The only trick I know
is to add the pan filter to the chain, where you can specify the output
layout:

$ ffmpeg [...] -af "[...],amerge=7,pan=7.0" [...]

But I have no idea whether it does exactly the right thing for you.
Worth a try.

> I could maybe add a blank LFE if I knew the syntax.

Wouldn't that give you eight channels?

> Syntax seems different for avlib than for ffmpeg and amerge is an
> avlib function apparently?

Not sure what you're trying to say. ffmpeg uses the av* libraries,
libavfilter is one of them. But the syntax of the command line options
for ffmpeg, the command line tool, is quite well documented.

> Getting there.

We'll get you there, no doubt. :-)

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: Creating surround sound from mono wav files

Carl Zwanzig
In reply to this post by CherylJosie
On 12/23/2018 12:38 PM, CherylJosie wrote:
> ffmpeg version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers

Also consider updating your version of ffmpeg- that's really old.

z!
_______________________________________________
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".
dd
Reply | Threaded
Open this post in threaded view
|

Re: Creating surround sound from mono wav files

dd
Dear my friend,

I have upgraded to version 4.1, but still not work. What’s wrong? Is the scale_app can support 10bit with right version?

Hope your help, thanks a lot!

>> 在 2018年12月26日,05:15,Carl Zwanzig <[hidden email]> 写道:
>>
>> On 12/23/2018 12:38 PM, CherylJosie wrote:
>> ffmpeg version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
>
> Also consider updating your version of ffmpeg- that's really old.
>
> z!
> _______________________________________________
> 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: Creating surround sound from mono wav files

Carl Eugen Hoyos-2
2018-12-27 3:31 GMT+01:00, unicor <[hidden email]>:

> I have upgraded to version 4.1, but still not work.

What did you try and what does not work?
Did you see Moritz' comment?

Please do not top-post here, Carl Eugen
_______________________________________________
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".