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

Wilfried Weissmann wweissmann at realnetworks.com
Tue Aug 12 13:45:11 CEST 2014


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-merge-pcmenc-set-correct-bitrate-value.patch
Type: application/octet-stream
Size: 12099 bytes
Desc: 0001-merge-pcmenc-set-correct-bitrate-value.patch
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140812/47da34a4/attachment.obj>


More information about the ffmpeg-devel mailing list