How do I specify a lower audio bitrate for use with older devices?
#1
My usage of get_iplayer is to download to computer harddrive, then copy that file to a USB stick which is then plugged into the USB port of a Samsung 5100 TV.

All has been well using the option
Code:
tvmode hvfvhigh
for some while, albeit receiving the warning about remapping to hvfxsd.

Since the start of August 2017, downloaded material has not been usable as it has been missing the audio, although the files play well (audio and video) on a computer using VLC on Ubuntu.

I found various discussions regarding this, such as this:
https://www.computing.net/answers/window...11344.html

I discovered that simply recoding the file produced by get_iplayer with Handbrake using the "out-of-the-box" setting was sufficient to create a playable (audio and video) file.

Whilst this was working well, there was a lot of time spent on the download and re-encoding.  Also disk space was diminishing as I was keeping both versions.

using ffprobe I also discovered that the files directly produced by get_iplayer, at my options, were

Code:
   Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)


Delving further into the settings of Handbrake I discovered that the critical setting was the Audio bitrate, which was at 160K in the preset dropdown.

I have a little experience with ffmpeg and discovered that

Code:
for i in *.mp4; do ffmpeg -i $i -c:v copy -c:a aac -b:a 160K $i'-160K'.mp4; done

would also create a playable file.  The actual codec seemed not to matter, but the audio bitrate was the breaking point

Whilst not a programmer, I can often successfully fiddle with existing code, and opened up the perl get_iplayer.

I changed the line

Code:
push @codec_opts, ( '-c:v', 'copy', '-c:a', 'copy' );

to

Code:
push @codec_opts, ( '-c:v', 'copy', '-c:a', 'aac', '-ab', '128K' );

I  changed from 160K as acquisition will be one of 96K, 128K, 320K from the figures given here:
https://github.com/get-iplayer/get_iplay...i/modesref
and it seemed redundant to specify 160K.

This fixes my issue, but I realise that hard coding options is generally regarded as "a bad thing", and of course I am now degrading my master copy, from which there can be no return.

I wonder if the audio part of the tv options should be specifiable separately from the overall tvmode, or be specifiable within the options file?

I've written this up as fully as I can partly to help any others who hit this problem with older TVs - I understand that it also affects many Sony models.  It's not a specific request for extra functionality.
#2
Just use --tvmode=dvfxsd (which should produce 96k audio), or another dvf mode.  As shown in the recording modes reference, the max audio bit rate for dvf modes is 128k.
#3
I'll try that now as I have a number of test files at various bitrates and can make the direct comparison.

Previously though, when I used to worry about mp3 v. cd "quality", I would have said that sub 128K bitrates were unacceptable - we'll see what difference age has made!

I'm trying to keep open the possibility of 960 x 540 video (otherwise - what's the point of a "big telly"?) at 128K (when available) but without going to dvfsd with 50fps which makes for large filesizes.
----------------------------------------------------------------------------------------------------
Update: Very subjective, using decent headphones, and not on any particularly "difficult" audio track - I can hear (just) the difference between the 94 kb/s files and other at a higher bitrate, but 164 kb/s and 317 kb/s sound the same.
#4
(31-08-2017, 01:46 PM)ears Wrote: I'm trying to keep open the possibility of 960 x 540 video (otherwise - what's the point of a "big telly"?) at 128K (when available) but without going to dvfsd with 50fps which makes for large filesizes.
I think you can do that with youtube-dl. It's not likely to be in get_iplayer any time soon.
#5
I wouldn't worry about audio bit-rates.
Using the mediainfo program (Linux):-
Code:
General
Complete name                            : /home/jeremy/Desktop/Links/Link to video/video/Professor T/S01E04.Double.Life.mp4
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42
[b]File size                                : 810 MiB[/b]
Duration                                 : 52mn 39s
Overall bit rate mode                    : Variable
Overall bit rate                         : 2 150 Kbps
Movie name                               : S01E04.Double.Life
Writing application                      : HandBrake 0.10.1 2015100400

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Main@L4.0
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 52mn 39s
[b]Bit rate                                 : 2 000 Kbps[/b]
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Frame rate                               : 25.000 fps
Minimum frame rate                       : 13.593 fps
Maximum frame rate                       : 25.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.087
Stream size                              : 746 MiB (92%)
Writing library                          : x264 core 146
Encoding settings                        : cabac=1 / ref=2 / deblock=1:0:0 / analyse=0x1:0x111 / me=hex / subme=4 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=1 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=20 / rc=abr / mbtree=1 / bitrate=2000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=20000 / vbv_bufsize=25000 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Audio
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : 40
Duration                                 : 52mn 39s
Bit rate mode                            : Variable
[b]Bit rate                                 : 160 Kbps[/b]
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 44.1 KHz
Compression mode                         : Lossy
[b]Stream size                              : 60.4 MiB (7%)[/b]
Title                                    : Stereo

Note that 160kB/sec audio makes up only 7% of the file size.
#6
(31-08-2017, 04:02 PM)JeremyBoden Wrote: I wouldn't worry about audio bit-rates.
...
Note that 160kB/sec audio makes up only 7% of the file size.

The problem I'm trying to overcome is not the overall size of the file which is related to the bitrates.

The issue is that some older devices - specifically the Samsung TV I identified in my original post, some old Sonys, and others as discussed in the linked computing.net forum thread, are incapable of rendering audio when it exceeds some unspecified bitrate - regardless of the codec.
I found many people floundering with this problem on other fora.