Jump to content

DLNA to transcode or not

GB Utah

Recommended Posts

Fairly new to home video distribution, but learning as I go.

A little bit about my setup:

(Home NAS, work in progress) WD 2TB HDD via USB3 to ASUS AC68 router.


Real NAS to built/installed soon. In the meantime, movies are a hodgepodge of old/older/new rips residing on WD USB3 HDD. All new rips are made using makemkv keeping DD5.1 then encoded using handbrake high preset and optimized for web checked. The resulting m4v file contains H264, AC3 (6 channel) and AAC (2 channel) passthrough for maximum compatibility, portability, etc


Router connects to 1gb switch for distro throughout house. WiFi is available, but all testing is conducted via 1gb ethernet, though some clients are only fast (100mb) ethernet.


I have recently been experimenting, trying to determine a good 'all-around' software solution. I understand there's no magic bullet, just trying different things to see what works. I have installed XBMC, Plex, MBS (MB3 release branch) on a middling laptop running an A4 APU (5400 I believe).


Here's my immediate question/concern/issue:


I have multiple videos described above (m4v container, H264 video, AC3/AAC audio) that play without transcode to a Sony BDP-S5100 via DLNA off of the ASUS router.

If I play the same files from MBS via DLNA on the same Sony BD, there's tons of blockiness, stuttering etc. I'm fairly certain this is due to trancoding. Leading to 2 questions:


1. It looks like you are implementing 'better' DLNA support to avoid trancoding when it isn't needed. I believe that would fix this issue. Am I correct?

2. Why would the simple fact of trancoding these simple encoded files cause the result to look so awful?


Thanks and sorry for the long post. Just wanted to include as much relevant detail as I could.


EDITED: Release branch of MBS NOT dev branch

Edited by GB Utah
Link to comment
Share on other sites

Have you seen this thread for BDP-S5200?  Might need to add m4v container to direct play.


See your Manual page 39.  If these modification don't work please post the server and transcoding log.

Link to comment
Share on other sites

Quote from linked post:

Looks like there are 2 Sony Blu-ray Player profiles one has more information then the other.  You would appear to using "Sony Blu-ray Player" profile.  Have you tried changing transcoding option from mpeg2video to h264?


Dashboard-DNLA-Profiles-System Profile "Sony Blu-ray Player"-Transcoding-Click "Video"-change mpeg2video to h264-click OK, then Save. (*Personally before hitting save I would go back to Info tab and customize "Name" so I can see in the log the profile being used.)


This will save a updated profile named "Sony Blu-ray Player" in the custom profile section. 



I quoted your directions from the linked post. It worked. Thank you.


This raises a couple of questions:

1. Why did it work? The setting that I changed indicated it was a ts container and my bluray device now incorrectly lists those m4v files as m2ts....

2. The current release version has 2 Sony Bluray Player profiles, one specified as 2013 which the BDP-S5100 most assuredly is/should be. Why are they mislabled/mislinked/missomethinged?


I still would wonder why the resulting transcode was so awful. Is that to be expected from my A4 APU?


Thanks again.

Link to comment
Share on other sites

  • 2 weeks later...

I've been doing a bit of research on this, looking at other media servers, testing, reading code, wiresharking, etc etc


I still don't have definitive answers, but maybe someone can assist if I provide more details.


I have hundreds of m4v (mp4) files I've encoded personally from our home DVD collection. They go through makemkv to handbrake with the high preset selected and web optimize selected. This results (given a fairly modern movie, we have tons of old westerns etc) in:


Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file:\\\Movies\Jack Reacher.m4v':
    major_brand     : mp42
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : HandBrake 0.10.0 2014112200
  Duration: 02:10:25.58, start: 0.094000, bitrate: 1268 kb/s
    Chapter #0:0: start 0.000000, end 501.817000
      title           : Chapter 1
    Chapter #0:1: start 501.817000, end 860.175000
      title           : Chapter 2
      title           : Chapter 18
    Stream #0:0(und), 3, 1/90000: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709, left), 720x368 [sAR 32:27 DAR 160:69], 1/180000, 652 kb/s, 23.98 fps, 59.94 tbr, 90k tbn, 180k tbc (default)
      handler_name    : VideoHandler
    Stream #0:1(eng), 2, 1/48000: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default)
      handler_name    : Stereo
    Stream #0:2(eng), 1, 1/48000: Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 448 kb/s
      handler_name    : Surround
    Stream #0:3(eng), 0, 1/1000: Subtitle: mov_text (text / 0x74786574)
      handler_name    : SubtitleHandler
Successfully opened the file.
Applying option map (set input stream mapping) with argument 0:0.
Applying option map (set input stream mapping) with argument 0:1.
Applying option map (set input stream mapping) with argument -0:s.
Applying option codec:v:0 (codec name) with argument copy.
Applying option bsf:v (A comma-separated list of bitstream filters) with argument h264_mp4toannexb.
Applying option map_metadata (set metadata information of outfile from infile) with argument -1.
Applying option codec:a:0 (codec name) with argument ac3.
Applying option ac (set number of audio channels) with argument 2.
Applying option ab (audio bitrate (please use -b:a)) with argument 128000.
Applying option af (set audio filters) with argument aresample=async=1.
Successfully parsed a group of options.
The above was taken from a release server transcode log file. The transcode occurred on a SONY BDP-S5100 after making the above change to the transcode section of the profile.
The current directplay settings of that profile include the following for Video:
Container: ts
Video Codec: mpeg1video,mpeg2video,h264
Audio Codec: ac3,aac,mp3,pcm
Container: mpeg
Video Codec: mpeg1video,mpeg2video
Audio Codec: ac3,mp3,pcm
Container: avi,mp4
Video Codec: mpeg4,h264
Audio Codec: ac3,aac,mp3,pcm



Given those settings for directplay, I have 2 specific questions:


1. Why was it transcoded at all? ffmpeg/ffprobe appear to correctly identify the file as an mp4 container, h264 video and aac/ac3 audio.


2. Why didn't MB3 simply take the existing ac3 audio in the file? When it was trancoded (the relevant setting on that tab is Prot:http, Container:ts, VCoded: h264, ACodec: ac3) the log indicates it copied the video and muxed the existing aac audio up(?) to ac3 audio, but 2 channel only.


I'm really trying to wrap my head around this and maybe help others in the process. When this same exact file is played back from my ASUS AC68 router with USB HDD attached (running minidlna), the video is played directly, FF/REW works, pause works, and audio is switchable between aac/ac3 surround during playback.


I'm working a setup to wireshark between the router (minidlna) and this BDP, but haven't gotten that far yet. Whole house is switched, no hubs available, and have to do some MITM.... 

Link to comment
Share on other sites

MBS needs to know the capabilities of the SONY BDP-S5100. I am not sure if our existing profiles will target that device or not. Even if they do, the profiles would need to be compared against the media.

Link to comment
Share on other sites

I can supply the DeviceSpy ProtocolInfo responses from my devices. I have in another thread. Unfortunately, as I'm sure you know, there are some US/EU/JP/KO differences within the DLNA guidelines.


While reading the code, dev branch, and checking packet captures between MBS and the BDP, correct me if I'm wrong, but I do not see anywhere that a ProtocolInfo request is ever made to the DMR?


So, if I hand copy the ProtocolInfo response from my device into my user profile xml (the only ProtocolInfo exposed in the GUI that I have found is the server's) that should alleviate this directly?

Shouldn't directplay settings made through the GUI override any user changes to the xml profile? You prefer users to make direct changes to the xml?

Link to comment
Share on other sites

I ran a similar test on the dev branch, but I haven't adjusted the trancoding setting on dev branch, it is simply the default SONY BDP profile, the packet capture shows the following being offered to the BDP (the exact same file for clarity)

res duration="02:10:25.5830000" nrAudioChannels="2" resolution="720x368" sampleFrequency="48000" bitrate="20000000" protocolInfo="http-get:*:video/vnd.dlna.mpeg-tts:DLNA.ORG_PN=MPEG_PS_NTSC;DLNA.ORG_OP=10;DLNA.ORG_CI=1;DLNA.ORG_FLAGS=01D00000000000000000000000000000">;test;042849e2745be4b20afff0d67f5d0b03;false;mpeg2video;ac3;1;;19872000;128000;6;;;;0;;635590536252126182;;;;</res 

This has me a bit stumped... the mime type presented and PN flag are a complete mis-match. MPEG_PS_NTSC should be video/mpeg mime type. I cannot locate within the dev branch code where this is coming from howerver.


EDIT:Fix code snip

Edited by GB Utah
Link to comment
Share on other sites

I guess my point is that I do have a handful of SONY devices, KDL-50EX645, PS3, BDP-S5100, BDP-S390 and I'm willing and trying to write profiles, make profiles work for them. I need to understand the logic of how the profiles are applied.


1. The DLNA guidelines mention a DMS/DMR/DMP (Control Point)... all discovering each other, check

2. Then broadly, ProtocolInfo is exchanged (server, I can offer the following formats...) (renderer, I can render the following formats...), no check?

3. Followed by CDS (browse, search), check

4. Followed by AVTransport playback, control, check


I realize there is a lot of dissension/discussion especially around SONY's implementation of DLNA therefore almost all DMS simply hard code profiles provide what the DMR can render regardless of the DMR stating it or not, while transcoding the rest. However, the minidlna embedded in my(most) routers does zero transcoding and I've only ever experienced problems when trying to playback files that were not encoded properly (DX50, DIVx, etc)


So for the simple use case of play this file, minidlna plays it 99% of the time with zero transcode, all audio available and transport controls.

I'd like to make that at least as possible with MB3 as well. But I need to figure the steps being used to perform step 2 above ( the profile...)


Can point me at the code that takes the logic contained in the xml profile and compares it to the formats MB3 is willing to offer?

Link to comment
Share on other sites

PROGRESS... (and a little confusion)


Version 3.0.5523.26298


With the attached profile my BDP-S5100 will direct play the vast majority of my collection (m4v, h264 H4.1, AAC, AC3) with one major caveat. I have to literally rename them from m4v>mp4 extension. I haven't had time to track down why on earth this is required. As far as I know, m4v is an mp4. Windows file extensions should be completely irrelevant.


Thought I'd post some progress here if it might help others.

5100 Sony Blu-ray Player.xml

Link to comment
Share on other sites

For anyone following along, the main issue was/is two-fold:


1. 95% of my content is the same (m4v, h264 H4.1, AAC, AC3(passthru)) and capable of direct stream to the 5100.

2. All of my m4v were being identified as MPEG.


To deal with/test this, I deleted the response line in the profile that 'mapped' mp4 to MPEG. Then I tried an mp4 file extension. Leaving the m4v extension in place caused MB3 to continue to treat the file as MPEG. Once the extension was changed to mp4, all of those files are now direct streamed, no transcoding, both audio tracks selectable, FF, REW, pause, etc all work.

  • Like 1
Link to comment
Share on other sites

Since you used HandBrake to do the conversions to m4v you would be safe in mass renaming all your m4v files to mp4 files using scripting, batch files.

Rename one or two and then use a tool like mediainfo to take a look at the file and make sure fast start/web optimize is still in affect.  If so you are good.  If not then you would want to script ffmpeg to remux the files using faststart for better playback experience (you should be good however).


There is very little difference in the files except the name FOR YOUR PURPOSE (for the most part).  This may or may not be true for others as m4v can have DRM applied and you would need to use a tool that can strip out the DRM.  It all depends on the source of the m4v file.



Link to comment
Share on other sites

  • 2 months later...

I am in a situation very similar to GB Utah so I will quote information from his post to describe my problem.

I am relatively ignorant to home video distribution and video content, but I am trying to learn.


Some information about relevant devices in my setup (not all mentioned):

-          A fast PC running different servers SW for test purpose: MBS, Plex, Serviio, WMS

-          Players: Toshiba 48L544xDG TV + Sony BDP S5200 (connected to TV) + PCs

-          Network: all devices connected through 1 GB switch except some laptops connected through WiFi - mainly used to control (try to control?) Sony BPD.


Main tests done using two movies: one is mp4 (AVC + AAC) and second is mkv (AVC + AC3)

When played directly through Ethernet on Toshiba TV both are excellent quality.

When played on Sony disc player, the mp4 is excellent but the mkv is pixelated pretty bad.

Based on information provided in this thread this seems to indicate that

-          for the Sony player the mp4 is played directly but the mkv movie is transcoded?

-          And for the Toshiba (no profile recognized) everything is played directly.


Here are some questions:

  1. How does the server recognize the player? Is there a way to specify to Emby server to use a specific profile for a specific player? For example for my Sony I would like to use the “Sony Blu-ray Player 2013” (which seems more adequate) rather than the “Sony Blu-ray Player”.
  2. Is there a way to create and use a profile for my Toshiba TV? If I look “devices” I can see the Blue Ray Disc Player but not my Toshiba TV even when playing a movie? Is this normal? If I click the select player icon I can select the blue ray as well as some other devices, but my Toshiba does not show up. Is that because it is not a ?renderer? ?
  3. I suppose that when a player is not recognized the server uses the default profile? The Default profile uses “direct” for avi & mp4 containers and “transcode” for TS container? As mkv container is define neither in direct nor in transcode, what is used in this case???
  4. Is there a documentation about the profile xml file? Where are the profile files kept? Most information in the xml file makes sense except <ProtocolInfo>. Where does the content come from?
  5. How do I know if a device uses transcoding or not?


Sorry for all these questions, as I said I am a novice in video server/players and I am probably asking dumb questions. But seems like I have a problems similar as the one described by GB Utah and I would be interested to find a solution at least for the Sony player

Link to comment
Share on other sites

I did more tests here are the results:

  • First I have tried to add an mkv container with codec mpeg4,h264 in the “direct play” tab. If I try to play the mkv movie from Emby the Sony player complains about unrecognized format.
  • So I did what is described elsewhere in this thread: In the “transcoding tab” I changed the mpeg2video to h264. Now the mkv movie plays with what seems to be good quality. However the FF/REV do not work (reset to movie to start point and stop playing???).

What is strange is that the mkv movie when placed on an USB stick plays without problem on the Sony. I have looked at the documentation and although not explained in detail it seems that some formats works from USB but “may not run” from DLNA???? No sure why but this would explained why when I tried to add the mkv container in direct play it did not work.


So here is the current situation:

Movies on an USB stick:

-          MP4 movie information indicates MP4 and is played perfectly. FF/REV work

-          MKV movie information indicates MKV and is played perfectly. FF/REV work

Movies from Plex DLNA

-          MP4 movie information indicates MPEG and is played perfectly. FF/REV work

-          MKV movie information indicates M2TS and is played perfectly? FF/REV work

Movies from Emby DLNA server using h264 for transcode

-          MP4 movie information indicates MPEG and is played perfectly. FF/REV work

-          MKV movie information indicates M2TS and is played perfectly? FF/REV do not work


I do not understand why the mkv movie is shown as M2TS? And why FF/REV do not work but situation is getting better.

Also in transcoding page we specify video codec as h264 in container ts? Why does this seems to be used for my mkv file???

All this is still misterious for me :)

Link to comment
Share on other sites

  • 3 months later...

This is your first post in this thread so it is probably best to describe your experience and then if you have a problem, describe that as well.

Link to comment
Share on other sites

  • 1 month later...

This is your first post in this thread so it is probably best to describe your experience and then if you have a problem, describe that as well.



I have the exact same problem, cant FF RW, films do not resume etc.  Still it has been months and months later and it is not solved??


I just want to be able to use FF and RW on my Sony BDP-5200 blu ray player...

Link to comment
Share on other sites

  • 2 weeks later...

I am in a similar position with my Sony BDP-5500, and I've made a profile that works very well with Serviio.  My problem is that no matter what I do, I can never get Emby to use the correct profile.  In the logs, it is getting the friendly name, model name, model number, etc., but the problem is that it says there is no matching profile, and it must use the default.  I've tried using just the friendly name, just the model name, just the model number, or all of them together, and I've even tried using HTTP Headers to match my Serviio logs, but no matter what, it will not match the profile.  If Serviio had a NextPVR plugin and web interface that supported PlayTo, and HTML 5 and no Flash, I'd probably just stick with it and count my supporter donation to Emby as a loss.  Plex has no issue detecting the Blu-ray player, Serviio has no problem detecting the player, yet even though I put correct matching info into the profile in Emby, it will never use it.


I also had a problem at first with updating my Xbox One profile as well, but I have been able to finally get it to use the correct profile.  I have a problem with that however, in which it will transcode the audio in the stream I am sending it, so my TV stream's 640k AC3 audio is getting transcoded down to 320k AC3, when it doesn't need to, and yes, I have AC3 audio listed for direct play.  In fact, the Xbox One will play the stream just fine directly using Serviio or Plex.  How I wish that Plex could show channels in the Xbox app or had an app specifically made for the Sony Blu-ray player, or that Serviio even had a NextPVR plugin.  I haven't had to do any sort of programming in a long time, I guess I may have to get back into it and develop a NextPVR plugin for Serviio, since between itself, Plex, and Serviio, it is the best at creating profiles that work very well, but only has a handful of people that actually work on plugins, and I have to make them all myself, or modify existing ones that are broken.


Sorry for rambling on, but between all three media servers, each one has some kind of disadvantage to it, as well as one thing it does very well.  If all three were combined together with the best parts of each, I'd finally be happy.


Edit:  There is a device page in the server settings, why can't we just assign a DLNA profile to a device on that page, instead of just having the option of renaming it?  That way, we don't have to hope Emby decides to use the correct DLNA profile based on the identification settings we supply.  Even with any or all of those settings entered correctly, sometimes it will just refuse to use the correct DLNA profile.  I had to rename my Xbox One name on the Xbox One itself, and then change the friendly name in the DLNA profile before Emby would decide to finally apply that profile to it.  And yes, I had the friendly name matching before I changed it, yet a change on the Xbox and the profile was needed before it worked.  I tried the same thing with my Blu-ray player, but that doesn't work unfortunately.  The profiles are seriously broken somewhere.

Edited by brienj
Link to comment
Share on other sites

For anybody that is having an issue with Emby saying it is using the profile in the logs, yet it not actually working, you MUST have at least one HTTP Header field filled out correctly.  I finally have everything working correctly.  My only problem is still working on how to ff/rew on files that need transcoded.  Luckily the Sony BDP-S5500 can handle practically every codec combination thrown at it in MKV containers.  It says it only supports up to level 4.1 AVC and only supports AAC in MP4, but I have been able to play level 5 AVC and even Dolby and DTS in MP4.  Once I have the profile tweaked, I'll share it.  There are just a few things that keep driving me crazy, and that is when Emby will transcode the AC3 from 640k to 320k, when it isn't needed, and the audio can just be copied.  Serviio never really has to transcode anything, just change the container and copy the streams.  That is why I need to completely understand how the Protocol Info and Response Profiles work, and also understand why Emby want to do extra work on reducing the bitrate of the audio when it transcodes.  I've increased the Max streaming Bitrate, which helped a lot of files not get transcoded at all, but on my Live TV streams, it still wants to reduce the quality of the audio stream for whatever reason, since it has to transcode to m2ts, but won't just copy the streams.  Serviio does zero transcoding of the stream, it just fakes out the player giving it a fake response.

Link to comment
Share on other sites

  • 3 months later...

Brienj, if you could share your profile it would be useful, I just bought the BDP-S5500 and I am having the same problems you experienced with mkv playback off EMBY server, playback through the USB port works absolutely fine for the same movies.

Link to comment
Share on other sites

  • 2 months later...

Brienj, if you could share your profile it would be useful, I just bought the BDP-S5500 and I am having the same problems you experienced with mkv playback off EMBY server, playback through the USB port works absolutely fine for the same movies.


I apologize for not seeing this earlier, since I just decided to use Plex, but now Plex changed their Roku player, which has got me pretty ticked, and so I came back to Emby for now.


At any rate, I've attached the profile I was last using that seemed to work pretty well.  I have a LOT of mkv files with DTS-HD and Dolby-TrueHD, and this profile for the Sony BDP-S5500 seems to work the best for me.


You may want to change the Friendly name in the xml file, but I changed it to my computer name so I would know that it was actually using my modified profile, I had a huge problem with Emby saying it was using the new profile, but it actually wasn't, and changing the friendly name of the server was the only way to verify that it really was using the new profile.

Sony Blu-ray Player 2015.7z

Edited by brienj
Link to comment
Share on other sites

  • 5 months later...

The latest beta of Emby Server, 3.1.125, has numerous fixes for Sony Blu ray players from years 2013-2016. The changes will also be in the next stable release of Emby Server. Since I have a device for testing I am now able to test it fully and with the changes I've made everything is now playing perfectly.

It's possible that some of these improvements can be applied to older players or sony bravia tv's, but I do not have those devices available to test with, so for that I'll need to rely on community help. Enjoy.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...