Sony Bravia AVC support
Brought to you by:
jmaggard
Attached is a patch to enable selective adjustment of DLNA profile information when serving to Sony BRAVIA televisions. These 2010 models natively support AVC playback in TS containers, but require the files to be listed with specific profiles.
As I was making this mod, it seems nona99 posted a similar solution, which works by altering the stored metadata for affected video files. By contrast, this patch directly amends the SOAP response on the fly when a BRAVIA television is detected. That means it shouldn't break anything for other DLNA clients.
I forgot to mention: the check for a BRAVIA TV searches the "X-AV-Client-Info" header for a "BRAVIA" string. This is reliable but fairly wide (note that it's more specific than the other model-specific catches already in the code). If this adversely affects future BRAVIA models (which seems unlikely) then a more specific check could be made. I know it affects model numbers like:
"BRAVIA KDL-##*X###"
e.g. "BRAVIA KDL-40EX503"
e.g. "BRAVIA KDL-32EX500"
e.g. "BRAVIA KDL-40NX600"
It probably affects more than this though.
Can you post the output from mediainfo on one of those files? I believe that DLNA profile should be for files with a 50i frame rate.
As I understand it, the profile to substitute is not actually important, it just needs to match one of the Bravia's so that the TV will list it and attempt to play it. However I think the AVC_TS_HD_50_AC3 profile (for example) is intended for 50p files. There are equivalents for 60p but, as I say, it makes no difference which is used.
Below is a 720p file that now works with the mod:
General
ID : 1 (0x1)
Complete name : /Users/aj/Movies/TV Shows/Battlestar Galactica 4/12 - A Disquiet Follows My Soul (ts).ts
Format : MPEG-TS
Format/Info : Advanced Video Codec
File size : 1.14 GiB
Duration : 43mn 5s
Overall bit rate : 3 802 Kbps
Video
ID : 4113 (0x1011)
Menu ID : 1 (0x1)
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.1
Format settings, CABAC : Yes
Format settings, ReFrames : 3 frames
Codec ID : 27
Duration : 43mn 5s
Bit rate mode : Variable
Bit rate : 3 243 Kbps
Maximum bit rate : 40.0 Mbps
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate : 23.976 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.147
Stream size : 994 MiB (85%)
Writing library : x264 core 65 r1037tw
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x133 / me=hex / subme=6 / psy_rd=1.0:0.0 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / chroma_qp_offset=-2 / threads=6 / nr=0 / decimate=1 / mbaff=0 / bframes=3 / b_pyramid=1 / b_adapt=2 / b_bias=0 / direct=3 / wpredb=1 / keyint=240 / keyint_min=24 / scenecut=40(pre) / rc=2pass / bitrate=3243 / ratetol=1.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / pb_ratio=1.30 / aq=1:1.0
Audio
ID : 4352 (0x1100)
Menu ID : 1 (0x1)
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Codec ID : 129
Duration : 43mn 5s
Bit rate mode : Constant
Bit rate : 384 Kbps
Channel(s) : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 KHz
Bit depth : 16 bits
Compression mode : Lossy
Stream size : 118 MiB (10%)
Language : English
See here for more info on getting this working in Servio:
http://forum.serviio.org/viewtopic.php?f=11&t=425&sid=2f9b3073562964da79f8dc6cd615d5cf
Has more details. Basically the TV is perfectly capable of playing all manner of AVC/AC3 files, but will only list ones advertised as one of its supported mime-types and profiles.
Thanks for the details. I've checked in your patch.