[FFmpeg-user] Stereo WMA to right / left mono WMA without reencoding

littlebat dashing.meng at gmail.com
Mon Oct 7 07:23:39 CEST 2013


On Sat, 5 Oct 2013 20:36:26 -0700
Tim Hiles <timothyhiles at gmail.com> wrote:

> So.. been trying to figure out if this is possible but can't seem to
> find this through google searches or in past ffmpeg list threads.
> All i want to do is split a stereo wma file into left and right mono
> files without reencoding... i.e. no conversion to wav.  the reason
> is, I have all of these wma recordings that are recorded on one side
> of a stereo file.  I'd like to save some space by getting rid of the
> blank side. converting to wav only creates a huge file, same goes
> when you convert to flac.. defeating the purpose of all of this in
> the first place.
> 
> 
> 
> Here's what I have so far:
> 
> WS400104.WMA file that is 204,040 KB
> 
> command:
> 
> c:\ffmpeg\ffmpeg\bin\ffmpeg.exe -i WS400104.WMA -map_channel 0.0.1:0.1
> -acodec copy out.wma
> 
> output:
> 
> ffmpeg version N-51683-g9dc88ac Copyright (c) 2000-2013 the FFmpeg
> developers
>   built on Apr  8 2013 21:19:21 with gcc 4.8.0 (GCC)
>   configuration: --enable-gpl --enable-version3 --disable-w32threads
> --enable-avisynth --enable-bzlib --enable-fontconfi
> g --enable-frei0r --enable-gnutls --enable-iconv --enable-libass
> --enable-libbluray --enable-libcaca --enable-libfreetyp
> e --enable-libgsm --enable-libilbc --enable-libmp3lame
> --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-li
> bopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger
> --enable-libsoxr --enable-libspeex --enable-libtheo
> ra --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc
> --enable-libvorbis --enable-libvpx --enable-libx264
>  --enable-libxavs --enable-libxvid --enable-zlib
>   libavutil      52. 25.100 / 52. 25.100
>   libavcodec     55.  2.100 / 55.  2.100
>   libavformat    55.  1.100 / 55.  1.100
>   libavdevice    55.  0.100 / 55.  0.100
>   libavfilter     3. 49.101 /  3. 49.101
>   libswscale      2.  2.100 /  2.  2.100
>   libswresample   0. 17.102 /  0. 17.102
>   libpostproc    52.  2.100 / 52.  2.100
> Guessed Channel Layout for  Input Stream #0.0 : stereo
> Input #0, asf, from 'WS400104.WMA':
>   Duration: 03:36:32.54, start: 0.000000, bitrate: 128 kb/s
>     Stream #0:0: Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, stereo,
> fltp, 128 kb/s
> File 'out.wma' already exists. Overwrite ? [y/N] y
> Output #0, asf, to 'out.wma':
>   Metadata:
>     WM/EncodingSettings: Lavf55.1.100
>     Stream #0:0: Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz,
> stereo, 128 kb/s
> Stream mapping:
>   Stream #0:0 -> #0:0 (copy)
> Press [q] to stop, [?] for help
> size=  218588kB time=03:36:32.51 bitrate= 137.8kbits/s
> video:0kB audio:203047kB subtitle:0 global headers:0kB muxing overhead
> 7.653751%
> 
> but as you see..  my output file is a stereo file.  So, I tried this:
> 
> command:
> 
> c:\ffmpeg\ffmpeg\bin\ffmpeg.exe -i WS400104.WMA -map_channel
> 0.0.1:0.1 -ac 1 out.wma
> 
> but got this:
> 
> output:
> 
> H:\asis\ansem2013>c:\ffmpeg\ffmpeg\bin\ffmpeg.exe -i WS400104.WMA
> -map_channel 0.0.1:0.1 -ac 1 out.wma
> ffmpeg version N-51683-g9dc88ac Copyright (c) 2000-2013 the FFmpeg
> developers
>   built on Apr  8 2013 21:19:21 with gcc 4.8.0 (GCC)
>   configuration: --enable-gpl --enable-version3 --disable-w32threads
> --enable-avisynth --enable-bzlib --enable-fontconfi
> g --enable-frei0r --enable-gnutls --enable-iconv --enable-libass
> --enable-libbluray --enable-libcaca --enable-libfreetyp
> e --enable-libgsm --enable-libilbc --enable-libmp3lame
> --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-li
> bopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger
> --enable-libsoxr --enable-libspeex --enable-libtheo
> ra --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc
> --enable-libvorbis --enable-libvpx --enable-libx264
>  --enable-libxavs --enable-libxvid --enable-zlib
>   libavutil      52. 25.100 / 52. 25.100
>   libavcodec     55.  2.100 / 55.  2.100
>   libavformat    55.  1.100 / 55.  1.100
>   libavdevice    55.  0.100 / 55.  0.100
>   libavfilter     3. 49.101 /  3. 49.101
>   libswscale      2.  2.100 /  2.  2.100
>   libswresample   0. 17.102 /  0. 17.102
>   libpostproc    52.  2.100 / 52.  2.100
> Guessed Channel Layout for  Input Stream #0.0 : stereo
> Input #0, asf, from 'WS400104.WMA':
>   Duration: 03:36:32.54, start: 0.000000, bitrate: 128 kb/s
>     Stream #0:0: Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, stereo,
> fltp, 128 kb/s
> File 'out.wma' already exists. Overwrite ? [y/N] y
> Output #0, asf, to 'out.wma':
>   Metadata:
>     WM/EncodingSettings: Lavf55.1.100
>     Stream #0:0: Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, mono,
> fltp, 128 kb/s
> Stream mapping:
>   Stream #0:0 -> #0:0 (wmav2 -> wmav2)
> Press [q] to stop, [?] for help
> size=  218572kB time=03:36:32.51 bitrate= 137.8kbits/s
> video:0kB audio:202999kB subtitle:0 global headers:0kB muxing overhead
> 7.671857%
> 
> which gives me a mono wma that is now bigger in size than the stereo
> wma I had to start out with. and also.. my bitrate is different
> (ffmpeg default?)
> 
> Would love and appreciate your help.
> 

Can't find a way without re-encoding. Try filter_complex: channelsplit,
like this:

ffmpeg -i test.wma \
-filter_complex 'channelsplit=channel_layout=stereo[FL][FR]' \
-map '[FL]' -b:a 64k left.wma -map '[FR]' -b:a 64k right.wma

See doc: http://ffmpeg.org/ffmpeg-filters.html#channelsplit


More information about the ffmpeg-user mailing list