[Fixed]MP3 bitrate not respected

Archive of historical bug reports.
Please use the GitHub link above to report issues.
Forum rules
*******************************
Please be aware we are now using GitHub for issue tracking and feature requests.
- This section of the forum is now closed to new topics.

*******************************
Post Reply
foxidrive
Posts: 4
Joined: Sun Jun 22, 2014 2:32 pm

[Fixed]MP3 bitrate not respected

Post by foxidrive »

The issue is that when I specify an MP3 bitrate of -B 192 then the log reports 160 KB/s and the resulting file reports 128 KB/s in VLC and Freemake audio converter.

Send a PM for URL to the source and target files (5 MB in total)

HandBrake-6216svn-i686-Win_CLI.zip
Win 8.1 32 bit
input file is test.mpg and target container is MKV

This is the command line that launches handbrakecli.exe

"HB\HandBrakeCLI.exe" -i "test.mpg" -o "d:\nocopy\test.mkv" --loose-crop -e x264 -q 23.0 -E copy:mp3 --audio-copy-mask mp3 --audio-fallback lame --mixdown stereo -B 192 -6 stereo -R Auto,Auto -D 0.0,0.0 --detelecine --decomb --loose-anamorphic -m -x b-adapt=2:rc-lookahead=50 2>test.log

Log follows:

Code: Select all

[00:55:25] hb_init: starting libhb thread
HandBrake svn6216 (2014062201) - MinGW i686 - http://handbrake.fr
8 CPUs detected
Opening test.mpg...
[00:55:25] CPU: Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
[00:55:25]  - Intel microarchitecture Sandy Bridge
[00:55:25]  - logical processor count: 8
[00:55:25] OpenCL: library not available
[00:55:25] Intel Quick Sync Video support: no
[00:55:25] hb_scan: path=test.mpg, title_index=1
libbluray/bdnav/index_parse.c:162: indx_parse(): error opening test.mpg/BDMV/index.bdmv
libbluray/bdnav/index_parse.c:162: indx_parse(): error opening test.mpg/BDMV/BACKUP/index.bdmv
libbluray/bluray.c:2182: nav_get_title_list(test.mpg) failed
[00:55:25] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 5.0.0
libdvdread: Encrypted DVD support unavailable.
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[00:55:25] dvd: not a dvd - trying as a stream/file instead
[00:55:25] file is MPEG Program Stream
[00:55:25] Probing 1 unknown stream
[00:55:25]     Probe: Found stream mpeg2video. stream id 0xe0-0x0
[00:55:25] Found the following streams
[00:55:25]     Video Streams : 
[00:55:25]       0xe0-0x0 type MPEG2 (0x2)
[00:55:25]     Audio Streams : 
[00:55:25]       0xc0-0x0 type MPEG2 (0x4)
[00:55:25]     Subtitle Streams : 
[00:55:25]     Other Streams : 
[00:55:25] stream id 0xc0 (type 0x4 substream 0x0) audio 0xc0
[00:55:25] dxva2:DxFindVideoServiceConversion failed
[00:55:25] scan: decoding previews for title 1
[00:55:25] scan: audio 0xc0: mp2, rate=48000Hz, bitrate=200000 Unknown (MPEG) (2.0 ch)

Scanning title 1 of 1, preview 4, 40.00 %[00:55:26] scan: 10 previews, 720x576, 25.000 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 64:45
[00:55:26] stream: 76 good frames, 0 errors (0%)
[00:55:26] libhb: scan thread found 1 valid title(s)
+ title 1:
  + stream: test.mpg
  + duration: 00:00:05
  + size: 720x576, pixel aspect: 64/45, display aspect: 1.78, 25.000 fps
  + autocrop: 0/0/0/0
  + support opencl: no
  + support hwd: no
  + chapters:
    + 1: cells 0->0, 0 blocks, duration 00:00:05
  + audio tracks:
    + 1, Unknown (MPEG) (2.0 ch) (iso639-2: und)
  + subtitle tracks:
MP3 Passthru requested and input codec is not compatible for track 1, using MP3 encoder
[00:55:26] 1 job(s) to process
[00:55:26] starting job
[00:55:26] yadif thread started for segment 0
[00:55:26] yadif thread started for segment 1
[00:55:26] yadif thread started for segment 2
[00:55:26] yadif thread started for segment 3
[00:55:26] yadif thread started for segment 4
[00:55:26] yadif thread started for segment 5
[00:55:26] yadif thread started for segment 6
[00:55:26] yadif thread started for segment 7
[00:55:26] decomb filter thread started for segment 0
[00:55:26] decomb filter thread started for segment 1
[00:55:26] decomb filter thread started for segment 2
[00:55:26] decomb filter thread started for segment 3
[00:55:26] decomb filter thread started for segment 4
[00:55:26] decomb filter thread started for segment 5
[00:55:26] decomb filter thread started for segment 6
[00:55:26] decomb filter thread started for segment 7
[00:55:26] decomb check thread started for segment 0
[00:55:26] decomb check thread started for segment 1
[00:55:26] decomb check thread started for segment 2
[00:55:26] decomb check thread started for segment 3
[00:55:26] decomb check thread started for segment 4
[00:55:26] decomb check thread started for segment 5
[00:55:26] decomb check thread started for segment 6
[00:55:26] decomb check thread started for segment 7
[00:55:26] mask filter thread started for segment 0
[00:55:26] mask filter thread started for segment 1
[00:55:26] mask filter thread started for segment 2
[00:55:26] mask filter thread started for segment 3
[00:55:26] mask filter thread started for segment 4
[00:55:26] mask filter thread started for segment 5
[00:55:26] mask filter thread started for segment 6
[00:55:26] mask filter thread started for segment 7
[00:55:26] mask erode thread started for segment 0
[00:55:26] mask erode thread started for segment 2
[00:55:26] mask erode thread started for segment 1
[00:55:26] mask erode thread started for segment 3
[00:55:26] mask erode thread started for segment 4
[00:55:26] mask erode thread started for segment 5
[00:55:26] mask erode thread started for segment 6
[00:55:26] mask erode thread started for segment 7
[00:55:26] mask dilate thread started for segment 0
[00:55:26] mask dilate thread started for segment 1
[00:55:26] mask dilate thread started for segment 2
[00:55:26] mask dilate thread started for segment 3
[00:55:26] mask dilate thread started for segment 4
[00:55:26] mask dilate thread started for segment 5
[00:55:26] mask dilate thread started for segment 6
[00:55:26] mask dilate thread started for segment 7
[00:55:26] work: compression level not specified, track 1 setting compression level 2.00
[00:55:26] sync: expecting 135 video frames
[00:55:26] work: only 1 chapter, disabling chapter markers
[00:55:26] job configuration:
[00:55:26]  * source
[00:55:26]    + test.mpg
[00:55:26]    + title 1, chapter(s) 1 to 1
[00:55:26]  * destination
[00:55:26]    + d:\nocopy\test.mkv
[00:55:26]    + container: Matroska (libavformat)
[00:55:26]  * video track
[00:55:26]    + decoder: mpeg2video
[00:55:26]      + bitrate 10000 kbps
[00:55:26]    + filters
[00:55:26]      + Detelecine (pullup) (default settings)
[00:55:26]      + Decomb (default settings)
[00:55:26]      + Framerate Shaper (0:27000000:1080000)
[00:55:26]        + frame rate: same as source (around 25.000 fps)
[00:55:26]      + Crop and Scale (720:576:0:0:0:0)
[00:55:26]        + source: 720 * 576, crop (0/0/0/0): 720 * 576, scale: 720 * 576
[00:55:26]    + loose anamorphic
[00:55:26]      + storage dimensions: 720 * 576, mod 0
[00:55:26]      + pixel aspect ratio: 64 / 45
[00:55:26]      + display dimensions: 1024 * 576
[00:55:26]    + encoder: H.264 (libx264)
[00:55:26]      + options: b-adapt=2:rc-lookahead=50
[00:55:26]      + quality: 23.00 (RF)
[00:55:26]  * audio track 1
[00:55:26]    + decoder: Unknown (MPEG) (2.0 ch) (track 1, id 0xc0)
[00:55:26]      + bitrate: 200 kbps, samplerate: 48000 Hz
[00:55:26]    + mixdown: Stereo
[00:55:26]    + encoder: MP3 (libmp3lame)
[00:55:26]      + bitrate: 160 kbps, samplerate: 48000 Hz
[00:55:26]      + compression level: 2.00
[00:55:26] file is MPEG Program Stream
[00:55:26] Probing 1 unknown stream
[00:55:26]     Probe: Found stream mpeg2video. stream id 0xe0-0x0
[00:55:26] reader: first SCR 288 id 0xe0 DTS 14400
[00:55:26] encx264: encoding at constant RF 23.000000
[00:55:26] encx264: unparsed options: b-adapt=2:rc-lookahead=50
x264 [info]: using SAR=64/45
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[00:55:26] mpeg2video: "Chapter 1" (1) at frame 0 time 3600
x264 [info]: profile High, level 3.0
[00:55:26] enclame: opening libmp3lame
[00:55:26] sync: first pts is 3600
[00:55:27] reader: done. 1 scr changes
[00:55:29] work: average encoding speed for job is 0.000000 fps
[00:55:29] sync: got 125 frames, 135 expected
[00:55:30] decomb: deinterlaced 31 | blended 20 | unfiltered 72 | total 123
[00:55:30] render: lost time: 10800 (0 frames)
[00:55:30] render: gained time: 10800 (4 frames) (0 not accounted for)
[00:55:30] mpeg2video-decoder done: 125 frames, 0 decoder errors, 0 drops
x264 [info]: frame I:2     Avg QP:20.56  size: 42341
x264 [info]: frame P:43    Avg QP:23.80  size: 23991
x264 [info]: frame B:76    Avg QP:27.59  size:  2714
x264 [info]: consecutive B-frames:  5.8%  9.9% 64.5% 19.8%
x264 [info]: mb I  I16..4: 15.3% 61.8% 22.9%
x264 [info]: mb P  I16..4:  1.9%  6.5%  0.7%  P16..4: 36.0% 19.1% 16.9%  0.0%  0.0%    skip:18.9%
x264 [info]: mb B  I16..4:  0.3%  0.4%  0.0%  B16..8: 32.4%  3.2%  1.0%  direct: 4.0%  skip:58.6%  L0:31.7% L1:52.6% BI:15.7%
x264 [info]: 8x8 transform intra:67.5% inter:69.1%
x264 [info]: coded y,uvDC,uvAC intra: 61.6% 64.8% 25.2% inter: 20.9% 17.7% 4.9%
x264 [info]: i16 v,h,dc,p: 50% 24% 17%  9%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 14% 36%  4%  3%  4%  3%  4%  4%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 14% 11%  7%  8% 10%  7%  8%  9%
x264 [info]: i8c dc,h,v,p: 44% 19% 32%  4%
x264 [info]: Weighted P-Frames: Y:11.6% UV:7.0%
x264 [info]: ref P L0: 60.5% 16.0% 17.7%  5.6%  0.2%
x264 [info]: ref B L0: 76.2% 20.5%  3.4%
x264 [info]: ref B L1: 90.6%  9.4%
x264 [info]: kb/s:2133.10
[00:55:30] mp2-decoder done: 0 frames, 0 decoder errors, 0 drops
[00:55:30] mux: track 0, 121 frames, 1322431 bytes, 2099.10 kbps, fifo 128
[00:55:30] mux: track 1, 210 frames, 97392 bytes, 154.59 kbps, fifo 256
[00:55:30] stream: 1551 good frames, 0 errors (0%)
[00:55:30] libhb: work result = 0

Encode done!
HandBrake has exited.
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: MP3 bitrate not respected

Post by s55 »

Heres what happened.

You asked for it to copy an MP3 track from the source to the output. The source doesn't have an MP3 track so it used the fallback encoder.

The fallback encoder option doesn't currently allow you to specify a bit-rate so it uses built-in defaults for the encoder. It's a limitation of that feature that we'll hopefully look at some point.

If your sources don't have MP3 audio tracks to begin with, just use the mp3 encoder with the bit-rate you want, rather than letting it fallback.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: MP3 bitrate not respected

Post by JohnAStebbins »

FYI, problem has been reported before and there is a patch on review board to fix it. I just need to address some comments and do some more testing.
viewtopic.php?f=10&t=28074
foxidrive
Posts: 4
Joined: Sun Jun 22, 2014 2:32 pm

Re: MP3 bitrate not respected

Post by foxidrive »

Thank you s55 and JohnAStebbins.

Also, thank you guys and gals who created Handbrake and continue to refine and polish it. Many Kudos.

My script has many features for general use with files, which is why I do it the way it is shown - though some of my understanding of Handbrake commands is limited.

Cheers
foxi
TedJ
Veteran User
Posts: 5388
Joined: Wed Feb 20, 2008 11:25 pm

Re: MP3 bitrate not respected

Post by TedJ »

Further note, VLC is notorious at misreporting MP3 audio bitrates especially if VBR/ABR is being used.
foxidrive
Posts: 4
Joined: Sun Jun 22, 2014 2:32 pm

Re: MP3 bitrate not respected

Post by foxidrive »

Thanks TedJ.

Windows explorer says 192 Kb/s
Xmedia Recode says it is 160 Kb/s
Freemake audio converter says it is 128 Kb/s
MediaInfo just says VBR

Do you know which bitrate is closer to the truth, or what the fallback default actually is?

Thanks.
Deleted User 11865

Re: MP3 bitrate not respected

Post by Deleted User 11865 »

foxidrive wrote:Windows explorer says 192 Kb/s
Xmedia Recode says it is 160 Kb/s
Freemake audio converter says it is 128 Kb/s
MediaInfo just says VBR

Do you know which bitrate is closer to the truth, or what the fallback default actually is?
MediaInfo. You can also check the encode log:

Code: Select all

[00:55:30] mux: track 1, 210 frames, 97392 bytes, 154.59 kbps, fifo 256
Are you 100% sure you specified -B 192, BTW? If the log says 160 Kbps, that's what will have been used for encoding…
foxidrive
Posts: 4
Joined: Sun Jun 22, 2014 2:32 pm

Re: MP3 bitrate not respected

Post by foxidrive »

Rodeo wrote:
foxidrive wrote: MediaInfo just says VBR
MediaInfo. You can also check the encode log:
Thanks - see above where I tried MediaInfo. It doesn't show a bitrate, just VBR

Code: Select all

Audio
Count                                    : 220
Count of stream of this kind             : 1
Kind of stream                           : Audio
Kind of stream                           : Audio
Stream identifier                        : 0
StreamOrder                              : 1
ID                                       : 2
ID                                       : 2
Unique ID                                : 18030
Format                                   : MPEG Audio
Commercial name                          : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 3
Internet media type                      : audio/mpeg
Codec ID                                 : A_MPEG/L3
Codec ID/Hint                            : MP3
Codec ID/Url                             : http://www.iis.fraunhofer.de/amm/index.html
Codec                                    : MPA1L3
Codec                                    : MPEG-1 Audio layer 3
Codec/Family                             : MPEG-A
Codec/Info                               : MPEG1 or 2 Audio Layer 3
Codec/Url                                : http://www.iis.fraunhofer.de/amm/index.html
Duration                                 : 1374880
Duration                                 : 22mn 54s
Duration                                 : 22mn 54s 880ms
Duration                                 : 22mn 54s
Duration                                 : 00:22:54.880
Bit rate mode                            : VBR
Bit rate mode                            : Variable
Channel(s)                               : 2
Channel(s)                               : 2 channels
Sampling rate                            : 48000
Sampling rate                            : 48.0 KHz
Samples count                            : 65994240
Compression mode                         : Lossy
Compression mode                         : Lossy
Delay                                    : 0
Delay                                    : 00:00:00.000
Delay, origin                            : Container
Delay, origin                            : Container
Delay relative to video                  : 0
Video0 delay                             : 0
Default                                  : Yes
Default                                  : Yes
Forced                                   : No
Forced                                   : No

Code: Select all

[00:55:30] mux: track 1, 210 frames, 97392 bytes, 154.59 kbps, fifo 256
Are you 100% sure you specified -B 192, BTW? If the log says 160 Kbps, that's what will have been used for encoding…
Absolutely sure. The command line was a copy and paste of the command that generated the log file.
I wasn't sure if the log reporting 160 Kb/s was accurate, given the three different values I quoted, and MediaInfo wussing out. :)

The guys above mentioned that it was the fallback default because of the way I used the commands, and that currently the default can't be overridden, but it's being worked on.
Deleted User 11865

Re: MP3 bitrate not respected

Post by Deleted User 11865 »

Duh, right - forgot about that. Sorry.
randomreuben
Veteran User
Posts: 468
Joined: Mon Nov 02, 2009 2:18 pm

Re: MP3 bitrate not respected

Post by randomreuben »

Here's a handy workaround I found for turning file formats, especially stereo files into formats that meet your exact requirements.

Encode the audio portion in stereo FLAC and store it in a .mkv container. Then extract the audio portion using MKVToolnix. Convert the .flac file into whatever format you like and then remux again with your new audio using MKVToolnix. I have degenerate hardware that requires audio that can't handle a minimum bitrate of 32kbps and so this technique is very useful to me. You can typically get this done completely in a script in Ubuntu.
Post Reply