Stream­ing video to a Sony Bravia (via DLNA)

I have a Sony Bravia TV with a net­work (eth­er­net) con­nec­tion. Let­ting aside the fact that he is in an­oth­er sub­net than my NAS and as such I can not use a DLNA (UPnP-​AV) serv­er (it is us­ing mul­tic­ast and the Simple Ser­vice Dis­cov­ery Pro­tocol (SSDP) which is not tra­vers­ing sub­nets in the WLAN-​LAN-​ADSL-​router I use), there is no good ex­plan­a­tion from Sony what I can feed to the TV.

When search­ing the net I can find some ob­scure sug­ges­tions and de­scrip­tions, but not all of them work for all people which try them. So it seems I have to re­search this my­self. Luck­ily my router has a build-​in UPnP-​AV serv­er which I can use to play around (the file size is lim­ited to the size of the USB memory stick I have con­nec­ted to the router, as he can not stream con­tent which is avail­able in a NAS in the net­work).

Sony tells the TV is able to re­ceive MPEG2 TS and PS con­tain­ers. MPEG2 PS is more or less what you have on DVD. It is able to play SD and HD con­tent from the PS con­tain­er, and the video format needs to be MPEG2. They do not ex­plain what SD or HD means in this con­text (the val­id res­ol­u­tions), and they do not tell what kind of au­dio is al­lowed.

For the MPEG2 TS con­tain­er they ad­di­tion­ally al­low H.264 video, and they spe­cify EU, EU-​T and EU-​ISO as sup­por­ted in this case. Again, they do not ex­plain what those EU* parts are sup­posed to mean.

For the un­spe­cified au­dio I as­sume this means AC-​3, AAC and MPEG Au­dio Lay­er 2 (some people use MP2 to de­scribe this au­dio format). I suc­cess­fully tested AAC and AC-​3, and I have read that MP2 works too. Based upon my ex­per­i­ences with the video part (more be­low) I as­sume the sampling rate and bitwidth mat­ter. So far I tried with 48 kHz and 16 bit per chan­nel.

For the EU* parts I have not found any trust­worthy ref­er­ence what this could mean, but it looks this refers to some as­pects of DVB/DVB-T/DVB-S(2) as it is used in Europe. I guess this is a bit linked with val­id res­ol­u­tions the TV is able to handle.

For the video part I have found mixed re­ports. From hat I have read in the Wiki­pe­dia page of the H.264 video format, I as­sumed the fail­ures are re­lated to a wrong res­ol­u­tion and maybe the fact that some parts of the video do not con­form to spe­cif­ic “levels” of the H.264 format. Some tell you are not al­lowed to use more than X ref­er­ence frames, some tell you can not use ad­vanced fea­ture Y.

The first test I did was to take the Sin­tel video from Blender. I down­loaded the MP4 ver­sion and re­muxed it in­to a MPEG2-​TS con­tain­er (I used ts­Mux­eR to do this). The TV was able to play the AAC au­dio, but it did not show the video. When I look at the video prop­er­ties, I see that it has a res­ol­u­tion of 1280×544 at 24 FPS. For H.264 videos which use the “High” pro­file and are com­pat­ible up to level 4.1, I do not see this res­ol­u­tion lis­ted as val­id in the Wiki­pe­dia page. Val­id res­ol­u­tions are 1280×720 at 30, 60 and 68.3 FPS, and 1280×1024 at 42.2 FPS. This could ex­plain why it is not work­ing.

As a second test I took a video res­ized it to 624×256 (I did not pay much at­ten­tion to the scale in the pro­gram I used to test this, I just hoped it takes a good one, now that I try to sum­mar­ize what I in­vest­ig­ated so far, I see that this size is not one of the val­id sizes lis­ted in the levels for H.264) at 23.976 FPS and reen­coded it with the de­fault op­tions of the x264 en­coder. The res­ult­ing video played just fine on the TV.

My third test was to en­code a res­ized (from 640×272 to 640×480) video at 23.976 FPS with weighted, upto 4 ad­apt­ive B-​frames, mixed ref­er­ences, 4 ref­er­ence frames, and some oth­er op­tions (this in­cludes B-​pyramid, which seems to be en­abled by de­fault). And again, the res­ult­ing video played just fine (des­pite the fact that I found com­ments in the net which sug­gest that B-​pyramid needs to be dis­abled…).

I still have to test some HD sizes, but it looks like one key as­pect for com­pat­ib­il­ity is that the video is en­coded with the right res­ol­u­tion (I have to ad­mit, I do not really know what this means, as one video had a res­ol­u­tion which was dif­fer­ent from what the val­id sizes for the H.264 levels are) and com­plies to only level 4.1 (or 4) and be­low (ba­sic­ally this means to obey some bitrate lim­it­a­tions and the num­ber of max. ref­er­ence frames for the giv­en res­ol­u­tion). The 23.976 FPS I men­tioned above are not lis­ted as one of the val­id FPS in the levels for H.264, so I do not think the FPS have to strictly con­form to what is spe­cified for the levels. It looks more this is just an up­per lim­it so that the video could also use some lower FPS.

So far I took the sin­tel video and ad­ded some black bor­ders on top and be­low to get to the 1080×720 res­ol­u­tion. I used avidemux 2.5.4 for this. The ver­sion I tried can only pro­duce a MP4 con­tain­er with this video/​audio com­bin­a­tion, and my hope was to re­mux it with ts­Mux­eR to a MPEG2-​TS, but ts­Mux­eR does not find a val­id video or au­dio stream in­side the MP4 con­tain­er. I am still search­ing for a pro­gram which is able to re­mux the res­ult­ing MP4 in­to a MPEG2-​TS. I found a tool which ex­tracts the streams from the MP4 con­tain­er, but the only free MPEG2-​TS mux­er seems to be ts­Mux­eR, which I was not able to con­vince to mux the two streams in­to a MPEG2-​TS file. It seems I have either to wait un­til avidemux knows how to gen­er­ate MPEG2-​TS streams with H.264 and AAC, or un­til it gen­er­ates a MP4 con­tain­er with H.264 and AAC which ts­Mux­eR is able to handle.

What I also want to test is, if I can use the open-​gop op­tions (either in “nor­mal” or in “bluray” mode), but I did not took the time to test this.

The only think I can tell defin­it­ively ATM is, that des­pite to all the in­form­a­tion I found in the net about this, noth­ing can be told about the hard re­quire­ments ex­cept, that the video en­cod­ing can not ex­ceed level 4.1 (or 4), be­cause so far no hard­ware de­coder chip seems to sup­port a high­er level. It seems I can use more or less all op­tions avail­able for the H.264 en­cod­ing, and the res­ol­u­tion and FPS does not seem to mat­ter that much. I looks more that you have to find a ver­sion of an H.264 en­coder which works for you, and after that you can more or less do what you want.

2 thoughts on “Stream­ing video to a Sony Bravia (via DLNA)”

  1. I’ve just got a Bravia TV as well, but haven’t got round to set­ting up DLNA stream­ing yet.(I’ve got build­ers in as well.) I’d pre­sume that HD in this case is the TV’s nat­ive res­ol­u­tion of 1920×1080, and that SD is stand­ard defin­i­tion for PAL/​SECAM as we’re in Europe. That’s 576 pixels high, and the width de­pends on wheth­er it’s 4:3 or 16:9 ra­tio.

    1. It is not as easy as that. The TV is for sure able to handle the 720p and 1080i res­ol­u­tions (I have TV chan­nels which use them). I am not sure about 1080p. It is also able to handle 480p (e.g. when you con­nect a Wii with a spe­cial cable and change the res­ol­u­tion in the op­tions of the Wii). As you can read in the text, I already suc­cess­fully tried a SD res­ol­u­tion which is dif­fer­ent from what is used in TV chan­nels in PAL/​SECAM re­spect­ively PAL plus. And if you look at the table about the dif­fer­ent levels of H.264 which is ref­er­enced in my text, you will see that there are some more res­ol­u­tions defined.

Leave a Reply

Your email address will not be published. Required fields are marked *