Difference between revisions of "User:Mjb/Serviio"

From Offset
Jump to navigationJump to search
(Dish Hopper support)
(Samsung BD-C6500 support)
Line 32: Line 32:
 
<pre>
 
<pre>
 
<Profile id="SamsungBDC6500" name="Samsung BD-C6500" extendsProfileId="7">
 
<Profile id="SamsungBDC6500" name="Samsung BD-C6500" extendsProfileId="7">
      <!-- Supposedly these are what it supports:
+
  <!-- Supposedly these are what it supports:
          audio file types: MP3, WMA
+
  audio file types: MP3, WMA
          video must be 1920x1080 max, but max video bitrate seems to be about 17 Mbps, and at 1080p more like 11 Mbps.
+
  video must be 1920x1080 max, but max video bitrate seems to be about 17 Mbps, and at 1080p more like 11 Mbps.
            AVI video: DivX 3.11/4.x/5.1/6.0, XviD, MP4v3, H.264 BP/MP/HP
+
AVI video: DivX 3.11/4.x/5.1/6.0, XviD, MP4v3, H.264 BP/MP/HP
            AVI audio: MP3, AC3, DTS, WMA, PCM
+
AVI audio: MP3, AC3, DTS, WMA, PCM
            MKV video: VC-1 AP, DivX 5.1/6.0, XviD, H.264 BP/MP/HP
+
MKV video: VC-1 AP, DivX 5.1/6.0, XviD, H.264 BP/MP/HP
            MKV audio: MP3, AC3, DTS
+
MKV audio: MP3, AC3, DTS
            WMV video: VC-1 AP, VC-1 SM
+
WMV video: VC-1 AP, VC-1 SM
            WMV audio: WMA
+
WMV audio: WMA
            MP4 video: MP4, H.264 BP/MP/HP
+
MP4 video: MP4, H.264 BP/MP/HP
            MP4 audio: AAC
+
MP4 audio: AAC
            MPEG-PS/TS video: MPEG1, MPEG2, H.264 BP/MP/HP
+
MPEG-PS/TS video: MPEG1, MPEG2, H.264 BP/MP/HP
            MPEG-PS/TS audio: MP1, MP2, AC3, DTS
+
MPEG-PS/TS audio: MP1, MP2, AC3, DTS
      -->
+
  -->
 
<Detection>
 
<Detection>
 
<HttpHeaders>
 
<HttpHeaders>
Line 51: Line 51:
 
</HttpHeaders>
 
</HttpHeaders>
 
</Detection>
 
</Detection>
      <Transcoding>
+
  <Transcoding>
        <Video targetContainer="mpegts" targetVCodec="mpeg2video" targetACodec="ac3" aBitrate="448" maxVBitrate="11000" forceVTranscoding="true">
+
<Video targetContainer="mpegts" targetVCodec="mpeg2video" targetACodec="ac3" aBitrate="448" maxVBitrate="11000" forceVTranscoding="true">
            <Matches container="mpeg" aCodec="lpcm"/>
+
<Matches container="mpeg" aCodec="lpcm"/>
            <Matches container="*" aCodec="dca" />
+
<Matches container="*" aCodec="dca" />
            <Matches container="*" aCodec="dts-hd" />
+
<Matches container="*" aCodec="dts-hd" />
            <Matches container="*" vCodec="h264" profile="high" levelGreaterThan="4.0" />
+
<Matches container="*" aCodec="eac3" />
            <Matches container="*" vCodec="h264" profile="high_422"/>
+
<Matches container="*" vCodec="h264" profile="high" levelGreaterThan="4.0" />
            <Matches container="*" vCodec="h264" profile="high_444"/>
+
<Matches container="*" vCodec="h264" profile="high_422"/>
            <Matches container="*" vCodec="h264" profile="high_10"/>
+
<Matches container="*" vCodec="h264" profile="high_444"/>
        </Video>
+
<Matches container="*" vCodec="h264" profile="high_10"/>
      </Transcoding>
+
</Video>
 +
  </Transcoding>
 
</Profile>
 
</Profile>
 
</pre>
 
</pre>

Revision as of 14:55, 12 May 2018

Serviio is a streaming media server. I use it to allow DLNA-capable devices to access video, audio and image files on my computer. For example, I can use my TV, through my Blu-Ray Disc (BD) player, to watch videos that are on a network drive accessible to the computer that runs Serviio.

After replacing my WiFi router with an AirPort Time Capsule, Serviio on my Win7 PC was no longer seen by my BD player. Serviio running on a Mac on the same network had no problem. Both computers are using a wired connection to the router. Disabling firewalls on the PC didn't make a difference. I eventually figured out a solution, but didn't make a note of what it was.

Transcoding

DLNA devices are supposed to be able to tell Serviio what formats they can handle, but my BD player does not really do a good job of this. If the bitrate is too high or the format is unrecognized, the file won't play. Serviio can transcode these files, though.

The transcoding configuration is in Serviio's profiles.xml file. Nowadays, instead of editing it directly, you are supposed to create a new file named user-profiles.xml, and put your enhancements in there. The format is the same as for profiles.xml. More info: http://serviio.org/index.php?option=com_content&view=article&id=24

My user-profiles.xml

Here's what I am using currently in my user-profiles.xml.

Samsung BD-C6500 support

To enhance support for my Blu-Ray player, a BD-C6500, which is one of the older Samsung "C" models. As compared to the Samsung B/C profile, which works pretty well, I am adding the following features:

  • Transcode any of the following to an MPEG-TS stream with MPEG-2 video (max. 11 Mbps) + AC-3 audio:
    • Any MPEG-PS (VOB) file containing PCM audio (this player cannot play such audio correctly, at least when streamed)
    • Any file containing DTS audio (this player does its own DTS to DD transcoding if using optical out, but I prefer to do it myself)
    • Any file containing DTS-HD audio (I don't think this player handles it at all)
    • Any file containing H.264 High 4.1 video (probably only 1080p content with bitrates too high to handle)
    • Any file containing H.264 High 4:2:2, 4:4:4, or 10 video (I made some 4:2:2 versions of DV rips)

Some 1080p and even 720p content can still have too-high of bitrate for this player to handle, even if it is not H.264 High 4.1, but Serviio does not yet have a way of matching files based on their bitrate. Matching the codec and profile/level combo is the best we can do.

I am not sure the Detection section I added actually works. I usually just manually select a profile in Serviio Console, and this overrides the detection algorithm.

When transcoding to MPEG, these particular Samsung players do not allow navigating forward and back within the stream.

<Profile id="SamsungBDC6500" name="Samsung BD-C6500" extendsProfileId="7">
	  <!-- Supposedly these are what it supports:
		   audio file types: MP3, WMA
		   video must be 1920x1080 max, but max video bitrate seems to be about 17 Mbps, and at 1080p more like 11 Mbps.
			 AVI video: DivX 3.11/4.x/5.1/6.0, XviD, MP4v3, H.264 BP/MP/HP
			 AVI audio: MP3, AC3, DTS, WMA, PCM
			 MKV video: VC-1 AP, DivX 5.1/6.0, XviD, H.264 BP/MP/HP
			 MKV audio: MP3, AC3, DTS
			 WMV video: VC-1 AP, VC-1 SM
			 WMV audio: WMA
			 MP4 video: MP4, H.264 BP/MP/HP
			 MP4 audio: AAC
			 MPEG-PS/TS video: MPEG1, MPEG2, H.264 BP/MP/HP
			 MPEG-PS/TS audio: MP1, MP2, AC3, DTS
	  -->
	<Detection>
		<HttpHeaders>
			<User-Agent>.*SEC_HHP_BD-C6500.*</User-Agent>
		</HttpHeaders>
	</Detection>
	  <Transcoding>
		 <Video targetContainer="mpegts" targetVCodec="mpeg2video" targetACodec="ac3" aBitrate="448" maxVBitrate="11000" forceVTranscoding="true">
			<Matches container="mpeg" aCodec="lpcm"/>
			<Matches container="*" aCodec="dca" />
			<Matches container="*" aCodec="dts-hd" />
			<Matches container="*" aCodec="eac3" />
			<Matches container="*" vCodec="h264" profile="high" levelGreaterThan="4.0" />
			<Matches container="*" vCodec="h264" profile="high_422"/>
			<Matches container="*" vCodec="h264" profile="high_444"/>
			<Matches container="*" vCodec="h264" profile="high_10"/>
		 </Video>
	  </Transcoding>
</Profile>

Roku Stick support

I have an old Samsung "A" model TV from 2008, and in 2018 I added a Roku Stick to it. I was not having much luck with the Roku profiles that came with Serviio, so I made my own:

<!--
Roku Stick (2017 model)

The help screen in the app says these formats are supported:
Video(H.264) - MKV, MOV, MP4
Audio - AAC, MP3, WMA, WAV(PCM), AIFF, FLAC
Audio - Ogg
Photo - JPEG, PNG(2Kx2K), GIF(2Kx2K)

The help screen also says "Dolby Digital is supported via pass through
on MKV, MP4 and MOV files. DTS is supported via pass through on MKV."

If it cannot play a file under any circumstances, the file won't show up
in the app. So if you see the file, the app will at least feed the file
to the Roku Stick. However, the Roku Stick's settings may interfere with
the transmission to the next device in the chain. Also, that device may
not like what it gets.

In my case, the Roku Stick is plugged into a TV, a 2008 Samsung "A" model
with no audio configuration options to speak of. The Roku Stick has 2 audio
settings:
  Audio mode (Stereo or Auto)
  HDMI (Auto, PCM-Stereo, Dolby D, Dolby D+, Dolby D & DTS, or Dolby D+ & DTS).

What you choose for HDMI affects what the Auto setting under Audio mode chooses.
If both are on Auto, and the TV's optical audio out is not connected to
anything, then the audio mode will be Auto (Stereo). But if I set HDMI to
something else, then the audio mode is Auto (whatever I chose).

If the audio mode is Stereo, the audio stream sent in video must be AAC or MP3.
Other formats like AC-3 or PCM will be silent.

If the audio mode includes DD, then AC-3 is supported.
Presumably E-AC-3 is supported if the audio mode includes DD+.

However if the audio mode includes DTS, it does not result in DTS audio
working for me. It is still silent. I think the TV just does not like it.

Audio in a video can be LPCM, but audio files transcoded to LPCM are not
supported by the Roku; they don't show up at all, so you have to transcode
them to MP3 instead.
-->
<Profile id="RokuStick" name="Roku Media Player on Roku Stick" extendsProfileId="RokuNo4kApp">
		<Transcoding>
			<Video targetContainer="mpegts" targetVCodec="h264" targetACodec="ac3" aBitrate="448">
				<!-- transcode videos in unsupported containers -->
				<Matches container="avi" />
				<Matches container="mpeg"/>
				<Matches container="mpegvideo"/>
				<Matches container="wtv"/>
				<!-- transcode videos with unsupported audio codecs -->
				<Matches container="*" aCodec="dca"/>
				<Matches container="*" aCodec="dts-hd"/>
				<Matches container="*" aCodec="flac"/>
				<Matches container="*" vCodec="wmv2"/>
				<Matches container="*" vCodec="mpeg1video"/>
				<Matches container="*" vCodec="mpeg2video" />
			</Video>
			<Video targetContainer="mpegts" targetVCodec="h264">
				<!-- transcode XviD/DivX video only; audio is probably AAC or MP3 already -->
				<Matches container="*" vCodec="mpeg4"/>
				<Matches container="*" vCodec="msmpeg4"/>
			</Video>
			<Audio targetContainer="mp3" aBitrate="320">
				<Matches container="ape" />
			</Audio>
		</Transcoding>
</Profile>

Dish Hopper support

Here's what I added to create a profile matching the Dish Hopper:

<Profile id="Hopper" name="Dish Hopper" extendsProfileId="1">
	<!--
	video: mp2t, mp1s, mpeg2, mp4, x-matroska
	audio: mpeg, mpeg3, mp3, mp4, mp4-latm
	image: jpeg

		If multiple audio streams, only the last one is played.
		If an MJPEG stream exists (e.g. for thumbnail), file will not play.
		Image slideshow is broken (as of May 2018); you can view 1 at a time though.
		Does not support H.264 in an MPEG-TS stream, so must transcode to MPEG-2 video.
		Audio is choppy if H.264 level > 4.1.
	-->
	  <Detection>
		 <UPnPSearch>
			<ModelName>Hopper</ModelName>
			<Manufacturer>Echostar</Manufacturer>
		 </UPnPSearch>
	  </Detection>
	  <Transcoding>
		 <Video targetContainer="mpegts" targetVCodec="mpeg2video" targetACodec="ac3" aBitrate="448" maxVBitrate="15000">
			<Matches container="*" aCodec="lpcm"/>
		 	<Matches container="*" aCodec="dca" />
		 	<Matches container="*" aCodec="dts-hd" />
		 	<Matches container="*" aCodec="eac3" />
			<Matches container="*" vCodec="h265" />
			<Matches container="*" vCodec="h264" levelGreaterThan="4.1"/>
			<Matches container="*" vCodec="h264" profile="high_422"/>
			<Matches container="*" vCodec="h264" profile="high_444"/>
			<Matches container="*" vCodec="h264" profile="high_10"/>
			<Matches container="*" vCodec="mpeg4"/>
			<Matches container="*" vCodec="theora"/>
			<Matches container="*" vCodec="dvvideo" />
			<Matches container="avi"/>
			<Matches container="flv"/>
		</Video>
		 <Audio targetContainer="mp3" aBitrate="320">
			<Matches container="ape"/>
			<Matches container="flac"/>
			<Matches container="lpcm"/>
			<Matches container="ogg"/>
		 </Audio>
	  </Transcoding>
</Profile>

H.264 levels above 3.1 can exceed 17 Mbps and 480p. Ideally we would only transcode those videos which actually need it, based on bitrate, but Serviio does not make this possible. So the question is, do you transcode all H.264 files above level 3.1, including those with lower bitrates which would play OK normally, or do you pick a higher level like 4.0 or 4.1 because those are more likely to have higher bitrates, taking the risk that some of your vids which need to be transcoded will not be? I am going with a 4.1 cutoff for now, and will see how it does.

Transcoding interlaced video

Serviio does not know how to recognize interlaced video, so it does not invoke FFmpeg with the correct parameters for transcoding it. The resulting progressive video sometimes appears jumpy/jittery because the interlacing wasn't taken into account during transcoding.

The developer has said that part of the problem is that ffmpeg -i does not reliably report whether video is interlaced. He's right; a container may have metadata saying the video is interlaced when it actually is not. Or it may only be partially interlaced. Or it may be interlaced but the container makes no mention of it.

Still, I think it would be nice if Serviio would just trust the metadata when it does happen to say the video is interlaced, i.e. when ffmpeg -i mentions "bottom first" or "top first". If the metadata is wrong or missing, this is a "not my problem" kind of problem.

Example:

Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, bottom first), 720x576 [SAR 16:15 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc

In the meantime, you have to just transcode such files yourself.

Unfortunately, this metadata is not always present, e.g. this DV video is interlaced, bottom first, but you wouldn't know it by the ffmpeg -i output:

Stream #0:0: Video: dvvideo (dvsd / 0x64737664), yuv411p, 720x480 [SAR 8:9 DAR 4:3], 28778 kb/s, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc

Somehow, MediaInfo reads something in this same file to know whether it is interlaced and which field is first. Why can't FFmpeg do this?

Well anyway, you have to transcode these files yourself, for now.

In FFmpeg, -deinterlace works, but is deprecated and is now just an alias for -vf yadif. This produces deinterlaced output at the input framerate. Alternatively, -flags +ilme+ildct also works. If the input and output are both MPEG-2 (e.g. VOB files), this produces interlaced output which can be played natively.

Java updates

Completely shut down Serviio before updating Java. See my notes on Java updates for more info.