Page 1 of 2

Bravias play H264 with AAC audio without transcoding to AC3

PostPosted: Sun Jan 08, 2012 9:21 am
by JezzaT
Using the Bravia TV profile I was having trouble with ffmpeg transcoding m2ts/BDAV/AVC/H264 video with AAC audio (ffmpeg crashed) and as I didn't see the need for the video to be transcoded at all I tried the Sony BD Player profile and the video played just fine without transcoding.

Having that work I modified a copy of the BD Player profile to transcode AVI files as per the Bravia TV profile and now I use that.

My question is: why does the Bravia TV profile transcode those video's?

Re: Using Sony BD Player profile for Bravia KDL-32V550

PostPosted: Sun Jan 08, 2012 9:47 am
by moltra
Manufactures change the firmware all the time, and the videos that play without transcoding changes.

Please post your model number and the changed part of the profile so we can review it.

also can you post the information on what the renderer will play. See signature to get what a renderer will play.

Re: Using Sony BD Player profile for Bravia KDL-32V550

PostPosted: Sun Jan 08, 2012 10:49 pm
by patters
The BD profile leaves audio intact most of the time since the BD players play most audio formats natively. DTS is transcoded to AC-3 only because ffmpeg can't remux it properly. I seem to recall that the Bravia profile is set to transcode all audio to AC-3. Does this mean that the Bravia might play AAC audio natively? I'll have to check...

Well, it definitely doesn't support AAC, and I have that exact same TV. Using the BD profile doesn't work at all for me for mp4 content, because the Bravia doesn't support MP4 container over DLNA, so I'm not sure what you may have done.

Re: Using Sony BD Player profile for Bravia KDL-32V550

PostPosted: Mon Jan 09, 2012 8:47 am
by Illico
JezzaT, 32V550 doesn't exist, do you mean 32V5500 model ?

Re: Using Sony BD Player profile for Bravia KDL-32V550

PostPosted: Mon Jan 09, 2012 8:50 am
by JezzaT
Illico wrote:JezzaT, 32V550 doesn't exist, do you mean 32V5500 model ?

Yeah sorry, missed a '0'

Re: Using Sony BD Player profile for Bravia KDL-32V5500

PostPosted: Mon Jan 09, 2012 10:08 am
by JezzaT
patters wrote:Well, it definitely doesn't support AAC, and I have that exact same TV. Using the BD profile doesn't work at all for me for mp4 content, because the Bravia doesn't support MP4 container over DLNA, so I'm not sure what you may have done.
Who said anything about MP4 containers? they don't work for me either but as I said M2TS containers do.
I downloaded http://downloads.dvdloc8.com/trailers/d ... railer.zip (or http://www.dvdloc8.com/clip.php?movieid=8419&clipid=2)
Remuxed to m2tS using tsMuxerGUI.
Video plays fine via USB and DLNA.

This guy has had similar results with AAC in M2TS container: http://www.leidinger.net/blog/2010/12/0 ... a-via-dlna

Re: Using Sony BD Player profile for Bravia KDL-32V5500

PostPosted: Mon Jan 09, 2012 12:25 pm
by patters
JezzaT wrote:Who said anything about MP4 containers? they don't work for me either but as I said M2TS containers do.

I used that as a test case since my mkv and m2ts files typically have AC-3 audio. So I modified the Bravia profile to remux mp4(h264+aac) to m2ts leaving the audio intact. My test file didn't play. I'll have a play with your sample when I get a chance, hopefully later this evening.

Thanks for that link. It does also rather confirm that h264 compatibility is resolution-dependent for 2009 Bravias. I have an open ticket for this with Zip, however it's low priority:
https://bitbucket.org/xnejp03/serviio/i ... resolution

Re: Using Sony BD Player profile for Bravia KDL-32V5500

PostPosted: Mon Jan 09, 2012 6:02 pm
by JezzaT
patters wrote:Thanks for that link. It does also rather confirm that h264 compatibility is resolution-dependent for 2009 Bravias. I have an open ticket for this with Zip, however it's low priority:
https://bitbucket.org/xnejp03/serviio/i ... resolution
Great - that answers what was going to be my next question - can a profile be made to transcoded non-playable h264 resolutions?
Though my Bravia can play a broader range of resolutions than listed here http://en.wikipedia.org/wiki/AVCHD
It would be good to know what resolutions the Bravia can play, for instance I have M2TS/h264 videos with these resolutions 720x424, 720x554, 720x386, 720x400 which play fine but 1216x720 wont.

Re: Using Sony BD Player profile for Bravia KDL-32V5500

PostPosted: Mon Jan 09, 2012 10:55 pm
by patters
That's interesting - it almost looks as if the problem is the height compliance rather than the width. However, I think most of the movie rips where they've removed the black bars are proper 1920 or 1280 width, and those don't tend to play. Maybe they need to be multiples of 16 or something. I remember having a similar issue with producing a valid picture aspect ratio from our hardware encoder at work for some webcasts:
http://pcloadletter.co.uk/2010/10/23/li ... and-wowza/

Re: Using Sony BD Player profile for Bravia KDL-32V5500

PostPosted: Tue Jan 10, 2012 12:42 pm
by JezzaT
patters wrote:That's interesting - it almost looks as if the problem is the height compliance rather than the width. However, I think most of the movie rips where they've removed the black bars are proper 1920 or 1280 width, and those don't tend to play. Maybe they need to be multiples of 16 or something.
It might just be the aspect ratio. Doing a quick google for 'bravia dlna h264' found these two threads:
http://www.ps3mediaserver.org/forum/vie ... f=6&t=3278
http://www.ps3mediaserver.org/forum/vie ... f=6&t=5062
Which seem to say a 16/9 AR is what's needed.
I will test further...

Re: Using Sony BD Player profile for Bravia KDL-32V5500

PostPosted: Sun Jan 15, 2012 9:34 am
by JezzaT
I revisited this now that 0.6.1 is out and I've noticed that ffmpeg no longer crashes transcoding m2ts/BDAV/H264/AAC but still it would be nice not to transcode unnecessarily.
This time to stop that I changed the new
<Profile id="9" name="Sony Bravia TV (2011)" extendsProfileId="1">
profile by changing this:

  Code:
<Video targetContainer="mpegts" forceInheritance="true">
   <Matches container="avi" vCodec="h264" aCodec="ac3" />
   <Matches container="mp4" vCodec="h264" aCodec="ac3" />
   <Matches container="matroska" vCodec="h264" aCodec="ac3" />
</Video>

To this:
  Code:
<Video targetContainer="mpegts" forceInheritance="true">
   <Matches container="avi" vCodec="h264" aCodec="ac3" />
   <Matches container="mp4" vCodec="h264" aCodec="ac3" />
   <Matches container="matroska" vCodec="h264" aCodec="ac3" />
   <Matches container="avi" vCodec="h264" aCodec="aac" />
   <Matches container="mp4" vCodec="h264" aCodec="aac" />
   <Matches container="matroska" vCodec="h264" aCodec="aac" />
</Video>

And after the comment:
<!-- if audio different to ac3, must be transcoded -->
I removed the line:
<Matches container="mpegts" aCodec="aac" />

Re: Using Sony BD Player profile for Bravia KDL-32V5500

PostPosted: Sun Jan 15, 2012 7:47 pm
by zip
you added more files to be transcoded rather than removed transcoding if I can see right.

Re: Using Sony BD Player profile for Bravia KDL-32V5500

PostPosted: Mon Jan 16, 2012 9:06 am
by Illico
No, his modification :
- Not transcode audio aac when embedded with h264 in avi/mp4/matroska, but only remux.

I'll check that this week on my 2010 model.

Re: Using Sony BD Player profile for Bravia KDL-32V5500

PostPosted: Mon May 07, 2012 6:47 pm
by patters
I've had my eye on this problem to follow up for a while, because as a NAS owner I'm always keen to minimize unnecessary transcoding. The reason I hadn't initially been able to replicate JezzaT's findings were down to the need to edit the DLNA media type/mime type section at the top of the profile to add the AAC-in-mpegts formats too. Once that was done, and with JezzaT's changes made, AAC content played back without being transcoded on my 2009 Bravia, so I'm guessing it ought to be fine on newer Bravia models too. I also edited the OnlineTranscoding section to prevent AAC being transcoded there too. YouTube HD clips now play perfectly without any transcoding.

Illico, can you test this change to profile 9 (which all Bravias inherit) on your TV using Serviio 0.6.2?

  Code:
   <Profile id="9" name="Sony Bravia TV (2011)" extendsProfileId="1">
      <!-- same as older Bravia 2010/2009 except it supports AVI playback -->
      <Detection>
         <UPnPSearch>
            <FriendlyName>BRAVIA KDL-\d{2}([A-Z]X\d2\d|CX400).*</FriendlyName>
         </UPnPSearch>
      </Detection>
      <DeviceDescription>
         <!-- act as WMP so that the TV doesn't show root categories -->
         <ModelName>Windows Media Player Sharing</ModelName>
         <ModelNumber>3.0</ModelNumber>
         <Manufacturer>Microsoft Corporation</Manufacturer>
      </DeviceDescription>
      <ContentDirectoryMessageBuilder>org.serviio.upnp.service.contentdirectory.SonyDLNAMessageBuilder</ContentDirectoryMessageBuilder>
      <ContentDirectoryDefinitionFilter>org.serviio.upnp.service.contentdirectory.definition.WMPContentDirectoryDefinitionFilter</ContentDirectoryDefinitionFilter>
      <MediaFormatProfiles>
         <MediaFormatProfile mime-type="video/avi" name="">AVI</MediaFormatProfile>
         <!-- rename native mpeg2ts with h264/ac3/aac formats to those supported by the tv -->
         <MediaFormatProfile mime-type="video/vnd.dlna.mpeg-tts" name="AVC_TS_HD_24_AC3,AVC_TS_HD_50_AC3,AVC_TS_HD_60_AC3,AVC_TS_HD_EU">AVC_TS_MP_HD_AC3</MediaFormatProfile>
         <MediaFormatProfile mime-type="video/vnd.dlna.mpeg-tts" name="AVC_TS_HD_24_AC3,AVC_TS_HD_50_AC3,AVC_TS_HD_60_AC3,AVC_TS_HD_EU">AVC_TS_MP_SD_AC3</MediaFormatProfile>
          <MediaFormatProfile mime-type="video/vnd.dlna.mpeg-tts" name="AVC_TS_HD_24_AC3,AVC_TS_HD_50_AC3,AVC_TS_HD_60_AC3,AVC_TS_HD_EU">AVC_TS_MP_HD_AAC_MULT5</MediaFormatProfile>
         <MediaFormatProfile mime-type="video/vnd.dlna.mpeg-tts" name="AVC_TS_HD_24_AC3,AVC_TS_HD_50_AC3,AVC_TS_HD_60_AC3,AVC_TS_HD_EU">AVC_TS_MP_SD_AAC_MULT5</MediaFormatProfile>
         <MediaFormatProfile mime-type="video/vnd.dlna.mpeg-tts" name="AVC_TS_HD_24_AC3_T,AVC_TS_HD_50_AC3_T,AVC_TS_HD_60_AC3_T,AVC_TS_HD_EU_T">AVC_TS_MP_HD_AC3_T</MediaFormatProfile>
         <MediaFormatProfile mime-type="video/vnd.dlna.mpeg-tts" name="AVC_TS_HD_24_AC3_T,AVC_TS_HD_50_AC3_T,AVC_TS_HD_60_AC3_T,AVC_TS_HD_EU_T">AVC_TS_MP_SD_AC3_T</MediaFormatProfile>
         <MediaFormatProfile mime-type="video/vnd.dlna.mpeg-tts" name="AVC_TS_HD_24_AC3_T,AVC_TS_HD_50_AC3_T,AVC_TS_HD_60_AC3_T,AVC_TS_HD_EU_T">AVC_TS_HP_HD_MPEG1_L2_T</MediaFormatProfile>
         <MediaFormatProfile mime-type="video/vnd.dlna.mpeg-tts" name="AVC_TS_HD_24_AC3_T,AVC_TS_HD_50_AC3_T,AVC_TS_HD_60_AC3_T,AVC_TS_HD_EU_T">AVC_TS_HP_SD_MPEG1_L2_T</MediaFormatProfile>
         <MediaFormatProfile mime-type="video/vnd.dlna.mpeg-tts" name="AVC_TS_HD_24_AC3_T,AVC_TS_HD_50_AC3_T,AVC_TS_HD_60_AC3_T,AVC_TS_HD_EU_T">AVC_TS_MP_HD_AAC_MULT5_T</MediaFormatProfile>
         <MediaFormatProfile mime-type="video/vnd.dlna.mpeg-tts" name="AVC_TS_HD_24_AC3_T,AVC_TS_HD_50_AC3_T,AVC_TS_HD_60_AC3_T,AVC_TS_HD_EU_T">AVC_TS_MP_SD_AAC_MULT5_T</MediaFormatProfile>
         <!-- rename transcoded mpeg2ts with h264 to one of the TV's supported profiles -->
         <MediaFormatProfile mime-type="video/mpeg" name="AVC_TS_HD_24_AC3_ISO,AVC_TS_HD_50_AC3_ISO,AVC_TS_HD_60_AC3_ISO,AVC_TS_HD_EU_ISO">AVC_TS_MP_HD_AC3_ISO</MediaFormatProfile>
         <MediaFormatProfile mime-type="video/mpeg" name="AVC_TS_HD_24_AC3_ISO,AVC_TS_HD_50_AC3_ISO,AVC_TS_HD_60_AC3_ISO,AVC_TS_HD_EU_ISO">AVC_TS_MP_SD_AC3_ISO</MediaFormatProfile>
         <MediaFormatProfile mime-type="video/mpeg" name="AVC_TS_HD_24_AC3_ISO,AVC_TS_HD_50_AC3_ISO,AVC_TS_HD_60_AC3_ISO,AVC_TS_HD_EU_ISO">AVC_TS_HP_HD_MPEG1_L2_ISO</MediaFormatProfile>
         <MediaFormatProfile mime-type="video/mpeg" name="AVC_TS_HD_24_AC3_ISO,AVC_TS_HD_50_AC3_ISO,AVC_TS_HD_60_AC3_ISO,AVC_TS_HD_EU_ISO">AVC_TS_HP_SD_MPEG1_L2_ISO</MediaFormatProfile>
         <MediaFormatProfile mime-type="video/mpeg" name="AVC_TS_HD_24_AC3_ISO,AVC_TS_HD_50_AC3_ISO,AVC_TS_HD_60_AC3_ISO,AVC_TS_HD_EU_ISO">AVC_TS_MP_HD_AAC_MULT5_ISO</MediaFormatProfile>
         <MediaFormatProfile mime-type="video/mpeg" name="AVC_TS_HD_24_AC3_ISO,AVC_TS_HD_50_AC3_ISO,AVC_TS_HD_60_AC3_ISO,AVC_TS_HD_EU_ISO">AVC_TS_MP_SD_AAC_MULT5_ISO</MediaFormatProfile>
      </MediaFormatProfiles>
      <Transcoding>
         <!-- For dvr-ms files force mpeg2video transcoding to fix monotone timestamps problems -->
         <Video targetContainer="mpegts" targetACodec="ac3" forceVTranscoding="true" forceInheritance="true">
            <Matches container="asf" vCodec="mpeg2video" />
         </Video>
         <!-- Transcode all h264 video with HIGH/MAIN > Level 4.1 on MPEG-TS stream with MPEG2VIDEO and ac3 audio transcoding -->
         <!-- expected profile MPEG_TS_SD_EU/MPEG_TS_SD_NA/MPEG_TS_SD_KO -->
         <Video targetContainer="mpegts" targetVCodec="mpeg2video" maxVBitrate="17000" targetACodec="ac3" aBitrate="384" forceInheritance="true">
            <Matches container="avi" vCodec="h264" profile="high" levelGreaterThan="4.1" />
            <Matches container="avi" vCodec="h264" profile="main" levelGreaterThan="4.1" />
            <Matches container="matroska" vCodec="h264" profile="high" levelGreaterThan="4.1" />
            <Matches container="matroska" vCodec="h264" profile="main" levelGreaterThan="4.1" />
            <Matches container="mp4" vCodec="h264" profile="high" levelGreaterThan="4.1" />
            <Matches container="mp4" vCodec="h264" profile="main" levelGreaterThan="4.1" />
            <Matches container="mpegts" vCodec="h264" profile="high" levelGreaterThan="4.1" />
        <Matches container="mpegts" vCodec="h264" profile="main" levelGreaterThan="4.1" />
         </Video>
         <!-- Remux h264 video with AC3/AAC audio to MPEG-TS stream without transcoding -->
         <!-- expected profile AVC_TS_MP_HD_AC3_ISO -->
         <Video targetContainer="mpegts" forceInheritance="true">
            <Matches container="avi" vCodec="h264" aCodec="ac3" />
            <Matches container="mp4" vCodec="h264" aCodec="ac3" />
            <Matches container="matroska" vCodec="h264" aCodec="ac3" />
            <Matches container="avi" vCodec="h264" aCodec="aac" />
            <Matches container="mp4" vCodec="h264" aCodec="aac" />
            <Matches container="matroska" vCodec="h264" aCodec="aac" />
         </Video>
         <!-- Remux all other h264 video to MPEG-TS stream with ac3 audio transcoding -->
         <!-- expected profile AVC_TS_MP_HD_AC3_ISO -->
         <Video targetContainer="mpegts" targetACodec="ac3" aBitrate="384" forceInheritance="true">
            <Matches container="avi" vCodec="h264" />
            <Matches container="mp4" vCodec="h264" />
            <Matches container="flv" vCodec="h264" />
            <Matches container="matroska" vCodec="h264" />
            <!-- if audio different to ac3/aac, it must be transcoded -->
            <Matches container="mpegts" aCodec="mp3" />
            <Matches container="mpegts" aCodec="dca" />
            <Matches container="mpegts" aCodec="lpcm" />
            <Matches container="mpeg" aCodec="dca" />
            <Matches container="ogg" vCodec="mpeg4" />
         </Video>
         <!-- All Others video/audio codec will be transcoded into mpeg2ts, mpeg2video and ac3 audio -->
         <!-- expected profile MPEG_TS_SD_EU/MPEG_TS_SD_NA/MPEG_TS_SD_KO -->
         <Video targetContainer="mpegts" targetVCodec="mpeg2video" maxVBitrate="17000" targetACodec="ac3" aBitrate="192" forceInheritance="true">
            <Matches container="asf" />            
            <Matches container="mp4" />
            <Matches container="matroska" />
            <Matches container="flv" />
            <Matches container="wtv" />
            <Matches container="ogg" />
         </Video>
         <Audio targetContainer="lpcm" forceInheritance="true">
            <!-- To allow "pause" then "resume" functions and album art for TVs that support it - transcode to mp3 instead -->
            <Matches container="asf" />
            <Matches container="mp4" />
            <Matches container="ogg" />
            <Matches container="flac" />
            <Matches container="adts" />
         </Audio>
      </Transcoding>
    <OnlineTranscoding>
      <Video targetContainer="mpegts">
        <Matches container="mp4"/>
        <Matches container="flv" vCodec="h264"/>
        <Matches container="applehttp" vCodec="h264"/>
      </Video>
      <Video targetContainer="mpeg" targetVCodec="mpeg2video" targetACodec="ac3" aBitrate="384">
        <Matches container="asf"/> <!-- to support mms:// streams -->
        <Matches container="flv"/>
      </Video>
    </OnlineTranscoding>
   </Profile>

Re: Using Sony BD Player profile for Bravia KDL-32V5500

PostPosted: Mon May 07, 2012 7:43 pm
by Illico
patters wrote:Illico, can you test this change to profile 9 (which all Bravias inherit) on your TV using Serviio 0.6.2?

Good finding...(I forgot to look at this :oops: )
I try your profile with Serviio beta version (edit 2011 profile) on my 2010 model:

- MKV/AVC/AAC (Sintel trailer),(BigBuckBunny movie),(Iron_Man_2 trailer) : -vcodec copy -vbsf h264_mp4toannexb -copyts -acodec copy : GOOD
- MP4/AVC/AAC (Inception trailer): -vcodec copy -vbsf h264_mp4toannexb -copyts -acodec copy : GOOD
- AVI/AVC/AAC : no sample files

I had some stuttering but it's due to my low cpu.

Re: Bravias play H264 with AAC audio without transcoding to

PostPosted: Tue May 08, 2012 1:38 pm
by Illico
I also notice that Sony Bravia 2010/2011 support MPEGTS with AAC audio (Japan format), according to GetProtocolInfo :
http-get:*:video/vnd.dlna.mpeg-tts:DLNA.ORG_PN=MPEG_TS_JP_T;DLNA.ORG_FLAGS=8d700000000000000000000000000000,
    MPEG2 VIDEO MP@HL,MP@H-14,MP@ML 24Mbps, 1920*1080 @60i, MPEG-2 AAC 384kbps
So we could probably remove this line
<Matches container="mpegts" aCodec="aac" />
and add a MediaFormatProfile line, but I could not find a profile in the generic profile that matched:
<MediaFormatProfile mime-type="video/vnd.dlna.mpeg-tts" name="MPEG_TS_JP_T">XXXXXXXXXXXXXXX</MediaFormatProfile>

EDIT: I don't find any sample file to test.

Re: Bravias play H264 with AAC audio without transcoding to

PostPosted: Tue May 08, 2012 3:45 pm
by patters
Yep, that was already done. It wouldn't be able to play the remuxed mkv or mp4 files without that.

Re: Bravias play H264 with AAC audio without transcoding to

PostPosted: Wed May 09, 2012 7:43 am
by Illico
patters wrote:Yep, that was already done. It wouldn't be able to play the remuxed mkv or mp4 files without that.

OK for MPEGTS/AVC/AAC, we can release this modification.
But now I'm talking about MPEGTS / MPEG2VIDEO / AAC (not TS/AVC/AAC), do you really test this format, I don't have sample file ?
When this file TS/MPEG2VIDEO/AAC is delivered in native format, what mime-type and profile will be used?

Re: Bravias play H264 with AAC audio without transcoding to

PostPosted: Wed May 09, 2012 9:39 pm
by patters
Ah sorry, no I haven't tested that. I guess we could make a test file using FFmpeg, but I suppose that combination would be very unusual 'in the wild'. I'll test now on my 2009 model...

Re: Bravias play H264 with AAC audio without transcoding to

PostPosted: Wed May 09, 2012 10:07 pm
by patters
Interesting. Using uPnP Inpector and browsing Serviio I can see it's served up as MPEG_TS_SD_KO_ISO, which a European TV won't display in the folder.

@Zip - any idea why? The test file is here:
http://dl.dropbox.com/u/1188556/dolbycity-aac.m2ts