avcodec/mpegaudioenc_template: default to 384k bitrate as default

If 384k is too high for the samplerate, choose the closest
possible

Idea to increase the bitrate from: 46439e1562
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-04-09 05:18:11 +02:00
parent 39b192b8e1
commit 268b1eae22
4 changed files with 37 additions and 32 deletions

View File

@ -112,6 +112,11 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx)
if (avpriv_mpa_bitrate_tab[s->lsf][1][i] == bitrate)
break;
}
if (i == 15 && !avctx->bit_rate) {
i = 14;
bitrate = avpriv_mpa_bitrate_tab[s->lsf][1][i];
avctx->bit_rate = bitrate * 1000;
}
if (i == 15){
av_log(avctx, AV_LOG_ERROR, "bitrate %d is not allowed in mp2\n", bitrate);
return AVERROR(EINVAL);
@ -774,7 +779,7 @@ static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
}
static const AVCodecDefault mp2_defaults[] = {
{ "b", "128k" },
{ "b", "0" },
{ NULL },
};

View File

@ -1,4 +1,4 @@
f6eb0a205350bbd7fb1028a01c7ae8aa *tests/data/fate/acodec-mp2.mp2
96130 tests/data/fate/acodec-mp2.mp2
5a669ca7321adc6ab66a3eade4035909 *tests/data/fate/acodec-mp2.out.wav
stddev: 4384.33 PSNR: 23.49 MAXDIFF:52631 bytes: 1058400/ 1057916
9d3135841ef813fa9c81c41cdc2f1666 *tests/data/fate/acodec-mp2.mp2
288391 tests/data/fate/acodec-mp2.mp2
02f0b174b57c2c4b3d848a09e00e106e *tests/data/fate/acodec-mp2.out.wav
stddev: 3653.85 PSNR: 25.07 MAXDIFF:39971 bytes: 1058400/ 1057916

View File

@ -1,4 +1,4 @@
28fbc7485c7939f40368f79adccb3e3d *tests/data/fate/acodec-mp2fixed.mp2
96130 tests/data/fate/acodec-mp2fixed.mp2
87461bd4ce4b0e0cbbf6c43621baf261 *tests/data/fate/acodec-mp2fixed.out.wav
stddev: 4384.26 PSNR: 23.49 MAXDIFF:52632 bytes: 1058400/ 1057916
05445de0f0305df85db4ed0ce94e5f4c *tests/data/fate/acodec-mp2fixed.mp2
288391 tests/data/fate/acodec-mp2fixed.mp2
82f117c9345aa028bfb6cf5794432043 *tests/data/fate/acodec-mp2fixed.out.wav
stddev: 3653.84 PSNR: 25.07 MAXDIFF:39970 bytes: 1058400/ 1057916

View File

@ -1,49 +1,49 @@
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 417
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 1253
ret: 0 st:-1 flags:0 ts:-1.000000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 440
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 1276
ret: 0 st:-1 flags:1 ts: 1.894167
ret: 0 st: 0 flags:1 dts: 1.880816 pts: 1.880816 pos: 30093 size: 418
ret: 0 st: 0 flags:1 dts: 1.880816 pts: 1.880816 pos: 90279 size: 1254
ret: 0 st: 0 flags:0 ts: 0.788334
ret: 0 st: 0 flags:1 dts: 0.809796 pts: 0.809796 pos: 12956 size: 418
ret: 0 st: 0 flags:1 dts: 0.809796 pts: 0.809796 pos: 38870 size: 1254
ret:-1 st: 0 flags:1 ts:-0.317499
ret: 0 st:-1 flags:0 ts: 2.576668
ret: 0 st: 0 flags:1 dts: 2.586122 pts: 2.586122 pos: 41377 size: 418
ret: 0 st: 0 flags:1 dts: 2.586122 pts: 2.586122 pos: 124133 size: 1254
ret: 0 st:-1 flags:1 ts: 1.470835
ret: 0 st: 0 flags:1 dts: 1.462857 pts: 1.462857 pos: 23405 size: 418
ret: 0 st: 0 flags:1 dts: 1.462857 pts: 1.462857 pos: 70217 size: 1254
ret: 0 st: 0 flags:0 ts: 0.365002
ret: 0 st: 0 flags:1 dts: 0.365714 pts: 0.365714 pos: 5851 size: 418
ret: 0 st: 0 flags:1 dts: 0.365714 pts: 0.365714 pos: 17554 size: 1254
ret:-1 st: 0 flags:1 ts:-0.740831
ret: 0 st:-1 flags:0 ts: 2.153336
ret: 0 st: 0 flags:1 dts: 2.168163 pts: 2.168163 pos: 34690 size: 418
ret: 0 st: 0 flags:1 dts: 2.168163 pts: 2.168163 pos: 104071 size: 1254
ret: 0 st:-1 flags:1 ts: 1.047503
ret: 0 st: 0 flags:1 dts: 1.044898 pts: 1.044898 pos: 16718 size: 418
ret: 0 st: 0 flags:1 dts: 1.044898 pts: 1.044898 pos: 50155 size: 1253
ret: 0 st: 0 flags:0 ts:-0.058330
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 440
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 1276
ret: 0 st: 0 flags:1 ts: 2.835837
ret: 0 st: 0 flags:1 dts: 2.821224 pts: 2.821224 pos: 45139 size: 418
ret: 0 st: 0 flags:1 dts: 2.821224 pts: 2.821224 pos: 135418 size: 1254
ret: 0 st:-1 flags:0 ts: 1.730004
ret: 0 st: 0 flags:1 dts: 1.750204 pts: 1.750204 pos: 28003 size: 418
ret: 0 st: 0 flags:1 dts: 1.750204 pts: 1.750204 pos: 84009 size: 1254
ret: 0 st:-1 flags:1 ts: 0.624171
ret: 0 st: 0 flags:1 dts: 0.600816 pts: 0.600816 pos: 9613 size: 418
ret: 0 st: 0 flags:1 dts: 0.600816 pts: 0.600816 pos: 28839 size: 1254
ret: 0 st: 0 flags:0 ts:-0.481662
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 440
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 1276
ret: 0 st: 0 flags:1 ts: 2.412505
ret: 0 st: 0 flags:1 dts: 2.403265 pts: 2.403265 pos: 38452 size: 418
ret: 0 st: 0 flags:1 dts: 2.403265 pts: 2.403265 pos: 115356 size: 1254
ret: 0 st:-1 flags:0 ts: 1.306672
ret: 0 st: 0 flags:1 dts: 1.332245 pts: 1.332245 pos: 21315 size: 418
ret: 0 st: 0 flags:1 dts: 1.332245 pts: 1.332245 pos: 63947 size: 1254
ret: 0 st:-1 flags:1 ts: 0.200839
ret: 0 st: 0 flags:1 dts: 0.182857 pts: 0.182857 pos: 2925 size: 418
ret: 0 st: 0 flags:1 dts: 0.182857 pts: 0.182857 pos: 8777 size: 1254
ret: 0 st: 0 flags:0 ts:-0.904994
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 440
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 1276
ret: 0 st: 0 flags:1 ts: 1.989173
ret: 0 st: 0 flags:1 dts: 1.985306 pts: 1.985306 pos: 31764 size: 418
ret: 0 st: 0 flags:1 dts: 1.985306 pts: 1.985306 pos: 95294 size: 1254
ret: 0 st:-1 flags:0 ts: 0.883340
ret: 0 st: 0 flags:1 dts: 0.888163 pts: 0.888163 pos: 14210 size: 418
ret: 0 st: 0 flags:1 dts: 0.888163 pts: 0.888163 pos: 42631 size: 1254
ret:-1 st:-1 flags:1 ts:-0.222493
ret: 0 st: 0 flags:0 ts: 2.671674
ret: 0 st: 0 flags:1 dts: 2.690612 pts: 2.690612 pos: 43049 size: 418
ret: 0 st: 0 flags:1 dts: 2.690612 pts: 2.690612 pos: 129149 size: 1254
ret: 0 st: 0 flags:1 ts: 1.565841
ret: 0 st: 0 flags:1 dts: 1.541224 pts: 1.541224 pos: 24659 size: 418
ret: 0 st: 0 flags:1 dts: 1.541224 pts: 1.541224 pos: 73978 size: 1254
ret: 0 st:-1 flags:0 ts: 0.460008
ret: 0 st: 0 flags:1 dts: 0.470204 pts: 0.470204 pos: 7523 size: 418
ret: 0 st: 0 flags:1 dts: 0.470204 pts: 0.470204 pos: 22569 size: 1254
ret:-1 st:-1 flags:1 ts:-0.645825