[FFmpeg-devel] [PATCH] ffmpeg 0.10.x set correct bit rate in riff wav headers

Michael Niedermayer michaelni at gmx.at
Tue Aug 12 14:23:12 CEST 2014


On Tue, Aug 12, 2014 at 11:45:11AM +0000, Wilfried Weissmann wrote:
> Hi,
> 
> The attached patch fixes incorrect bit rate values in riff headers when a conversion is done from 16 bit samples to alaw.
> 
> [user at test ffmpeg-new]$ ./ffprobe ../sample.wav 2>&1 | tail -4
> Input #0, wav, from '../sample.wav':
>   Duration: 00:00:10.00, bitrate: 256 kb/s
>     Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, 1 channels,                        s16, 256 kb/s
> 
> [user at test ffmpeg-new]$ ./ffmpeg -i ../sample.wav -f wav -acodec pcm_alaw -ac 1                        -ar 8000  ../sample.alaw.wav
> ffmpeg version 0.10.14 Copyright (c) 2000-2014 the FFmpeg developers
>   built on Aug 12 2014 12:30:33 with gcc 4.1.2 20080704 (Red Hat 4.1.2-51)
>   configuration: --disable-yasm
>   libavutil      51. 35.100 / 51. 35.100
>  libavcodec     53. 61.100 / 53. 61.100
>   libavformat    53. 32.100 / 53. 32.100
>   libavdevice    53.  4.100 / 53.  4.100
>   libavfilter     2. 61.100 /  2. 61.100
>   libswscale      2.  1.100 /  2.  1.100
>   libswresample   0.  6.100 /  0.  6.100
> [wav @ 0x158813a0] max_analyze_duration 5000000 reached at 5120000
> Input #0, wav, from '../sample.wav':
>   Duration: 00:00:10.00, bitrate: 256 kb/s
>     Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, 1 channels,                        s16, 256 kb/s
> File '../sample.alaw.wav' already exists. Overwrite ? [y/N] y
> Output #0, wav, to '../sample.alaw.wav':
>   Metadata:
>     encoder         : Lavf53.32.100
>     Stream #0:0: Audio: pcm_alaw ([6][0][0][0] / 0x0006), 8000 Hz, 1 channels, s                       16, 64 kb/s
> Stream mapping:
>   Stream #0:0 -> #0:0 (pcm_s16le -> pcm_alaw)
> Press [q] to stop, [?] for help
> size=      78kB time=00:00:09.99 bitrate=  64.0kbits/s
> video:0kB audio:78kB global headers:0kB muxing overhead 0.072509%
> [user at test ffmpeg-new]$ ./ffprobe ../sample.alaw.wav 2>&1 | tail -4                                    Input #0, wav, from '../sample.alaw.wav':
>   Duration: 00:00:09.99, bitrate: 64 kb/s
>     Stream #0:0: Audio: pcm_alaw ([6][0][0][0] / 0x0006), 8000 Hz, 1 channels, s                       16, 64 kb/s
> 
> Without the patch ffprobe would report a bit rate of 128kb/s.
> 
> Greetings,
> Wilfried
> 

>  libavcodec/pcm.c             |    1 +
>  tests/ref/acodec/pcm_alaw    |    2 +-
>  tests/ref/acodec/pcm_mulaw   |    2 +-
>  tests/ref/seek/pcm_alaw_wav  |   36 ++++++++++++++++++------------------
>  tests/ref/seek/pcm_mulaw_wav |   36 ++++++++++++++++++------------------
>  5 files changed, 39 insertions(+), 38 deletions(-)
> b49e6729732102f81842fdc6f17c9bb690aea642  0001-merge-pcmenc-set-correct-bitrate-value.patch
> From 4cf471903c9285f3e7dd035f0ef9cf153ad28535 Mon Sep 17 00:00:00 2001

> From: user <user at localhost.localdomain>

like carl said, this looks wrong, but ive found the correct commit
from where this came already, ill backport it to
release/0.10 so it will be in the next release from that branch

thanks

PS: i suggest you use a modern FFmpeg like from the latest release
    which is 2.3.2 ATM, 0.10 is a bit old already ...

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Old school: Use the lowest level language in which you can solve the problem
            conveniently.
New school: Use the highest level language in which the latest supercomputer
            can solve the problem without the user falling asleep waiting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140812/e4d5fb37/attachment.asc>


More information about the ffmpeg-devel mailing list