Difference between revisions of "User:Mjb/Serviio"

From Offset
Jump to navigationJump to search
(Dish Hopper support)
(Dish Hopper support)
Line 153: Line 153:
 
Here's what I added to create a profile matching the Dish Hopper:
 
Here's what I added to create a profile matching the Dish Hopper:
  
<pre><Profile id="Hopper" name="Dish Hopper" extendsProfileId="1">
+
<pre style="font-size: 85%"><Profile id="Hopper" name="Dish Hopper" extendsProfileId="1">
 
<!--
 
<!--
 
video: mp2t, mp1s, mpeg2, mp4, x-matroska
 
video: mp2t, mp1s, mpeg2, mp4, x-matroska
Line 196: Line 196:
 
</Video>
 
</Video>
 
<Video targetContainer="mpegts" targetVCodec="mpeg2video" maxVBitrate="15000" targetACodec="ac3" aBitrate="448">
 
<Video targetContainer="mpegts" targetVCodec="mpeg2video" maxVBitrate="15000" targetACodec="ac3" aBitrate="448">
<Matches container="*" aCodec="dca"/>
+
<Matches container="*" aCodec="dca"/>
<Matches container="*" aCodec="dts-hd"/>
+
<Matches container="*" aCodec="dts-hd"/>
<Matches container="*" aCodec="eac3"/>
+
<Matches container="*" aCodec="eac3"/>
 
<Matches container="*" aCodec="lpcm"/>
 
<Matches container="*" aCodec="lpcm"/>
 
<Matches container="*" vCodec="dvvideo"/>
 
<Matches container="*" vCodec="dvvideo"/>

Revision as of 06:25, 4 June 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.

Transcoding

DLNA devices are supposed to be able to tell Serviio what formats they can handle natively, but some do not, or they do but don't provide enough detail. For example, they might be able to play a certain format, but they don't mention that it's only if the video bitrate is under a certain threshold. Serviio can transcode these unplayable files, and it supports many devices out of the box. Still, you may well have to add custom support for your devices, depending on what you're trying to play.

The transcoding configuration is in device "profiles" in Serviio's profiles.xml file. Nowadays, instead of editing it directly, you 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:

  • Remux any FLV file which contains H.264 video (older YouTube rips mainly)
  • Transcode any of the following to an MPEG-TS stream with MPEG-2 video (max. 11 Mbps) + AC-3 audio:
    • Any other FLV file
    • 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)
    • Any file containing VC-1 (despite being natively supported, the bitrate is likely to be too high for streaming)

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. Further complicating things is that the level is not always detected by Serviio, so a High 4.1 video may fail to get transcoded.

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">
	<!--
	The user manual says it supports the following:
		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">
			<Matches container="flv" vCodec="h264"/>
		</Video>
		<Video targetContainer="mpegts" targetVCodec="mpeg2video" targetACodec="ac3" aBitrate="448" maxVBitrate="11000" forceVTranscoding="true">
			<Matches container="flv"/>
			<Matches container="matroska" aCodec="lpcm"/>
			<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"/>
			<Matches container="*" vCodec="vc1"/>
		</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:

<Profile id="RokuStick" name="Roku Media Player on Roku Stick" extendsProfileId="RokuNo4kApp">
	<!--
	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.
	-->
	<Transcoding>
		<Video targetContainer="mpegts" targetVCodec="h264">
			<Matches container="*" vCodec="mpeg4" aCodec="aac"/>
			<Matches container="*" vCodec="mpeg4" aCodec="mp3"/>
			<Matches container="*" vCodec="msmpeg4" aCodec="aac"/>
			<Matches container="*" vCodec="msmpeg4" aCodec="mp3"/>
			<Matches container="flv" aCodec="aac"/>
			<Matches container="flv" aCodec="mp3"/>
		</Video>
		<Video targetContainer="mpegts" targetVCodec="h264" targetACodec="ac3" aBitrate="448">
			<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"/>
			<Matches container="avi"/>
			<Matches container="flv"/>
			<Matches container="mpeg"/>
			<Matches container="mpegvideo"/>
			<Matches container="wtv"/>
		</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

		Does support AAC audio in a video stream.
		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.
	-->
	<Detection>
		 <UPnPSearch>
			<ModelName>Hopper</ModelName>
			<Manufacturer>Echostar</Manufacturer>
		 </UPnPSearch>
	</Detection>
	<Transcoding>
		<Video targetContainer="mpegts" targetVCodec="mpeg2video" maxVBitrate="15000" maxHeight="720">
			<Matches container="*" vCodec="h264" levelGreaterThan="4.1" aCodec="aac"/>
			<Matches container="*" vCodec="h265" levelGreaterThan="4.1" aCodec="aac"/>
		</Video>
		<Video targetContainer="mpegts" targetVCodec="mpeg2video" maxVBitrate="15000">
			<!-- unsupported video with AAC or MP3 audio: transcode video only -->
			<Matches container="*" vCodec="h264" levelGreaterThan="4.1" aCodec="aac"/>
			<Matches container="*" vCodec="h264" profile="high_422" aCodec="aac"/>
			<Matches container="*" vCodec="h264" profile="high_444" aCodec="aac"/>
			<Matches container="*" vCodec="h264" profile="high_10" aCodec="aac"/>
			<Matches container="*" vCodec="h265" aCodec="aac"/>
			<Matches container="*" vCodec="mpeg4" aCodec="aac"/>
			<Matches container="*" vCodec="mpeg4" aCodec="mp3"/>
			<Matches container="avi" aCodec="aac"/>
			<Matches container="avi" aCodec="mp3"/>
			<Matches container="flv" aCodec="aac"/>
			<Matches container="flv" aCodec="mp3"/>
			<!--
			not working; see http://forum.serviio.org/viewtopic.php?f=7&t=24545
			<Matches container="*" vCodec="svq3" aCodec="aac"/>
			<Matches container="*" vCodec="svq3" aCodec="mp3"/>
			-->
		</Video>
		<Video targetContainer="mpegts" targetVCodec="mpeg2video" maxVBitrate="15000" targetACodec="ac3" aBitrate="448">
			<Matches container="*" aCodec="dca"/>
			<Matches container="*" aCodec="dts-hd"/>
			<Matches container="*" aCodec="eac3"/>
			<Matches container="*" aCodec="lpcm"/>
			<Matches container="*" vCodec="dvvideo"/>
			<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="h265"/>
			<Matches container="*" vCodec="mpeg4"/>
			<Matches container="*" vCodec="theora"/>
			<Matches container="*" vCodec="vc1"/>
			<Matches container="*" vCodec="wmv2"/>
			<Matches container="avi"/>
			<Matches container="flv"/>
			<!--
			not working; see http://forum.serviio.org/viewtopic.php?f=7&t=24545
			<Matches container="*" vCodec="cvid"/>
			<Matches container="*" vCodec="svq1"/>
			<Matches container="*" vCodec="svq3"/>
			-->
		</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.

nPlayer on iPad support

On iOS devices like the iPad or iPhone, there are various apps you can use as DLNA renderers. The iPad can even output HDMI via an adapter.

On a first-generation iPad, your options for free are quite limited. I found that the non-free but cheap nPlayer app works very well. It plays almost every format natively, so the default profile in Serviio works well enough.

Strangely, the first-generation iPad does quite well with H.264 content in an MP4/MOV or MKV container, but H.264 in an MPEG-TS stream, like you get when transcoding, totally brings it to its knees if you don't massively constrain the bitrate. I wonder if there is a better way.

<Profile id="nPlayer-iPad1" name="nPlayer on iPad (1st Gen)" extendsProfileId="1">
	<!--
		nPlayer caches like crazy. If it doesn't show up in Serviio Console,
		try deleting the Serviio entry from nPlayer's UPnP/DLNA network servers,
		so it can find it again and let Serviio know it's out there.

		Working video:
			containers: MKV, MP4, AVI, MPEG-TS, MPEG-PS
			video codecs: H.264 up to High L5, MPEG-1, MPEG-2, MPEG4, VP6, WMV, MJPEG
			audio codecs: AC-3, AAC, MP2, MP3, WMA, PCM, ADPCM(CCITT)
			audio in MPEG-TS: AC-3, MP3, MP2

		Non-working video codecs:
			DV drops frames and goes out of sync.
			H.263 does not show up when browsing.
			H.264 High L5.1 has no picture.
			H.264 High422 works but drops too many frames on this iPad (even at 480p 24fps).
			H.265 Main 10 L3.1 (at 480p 60fps) and L4 (at 1080p 24fps) stutters & drops many frames.
			transcoded video buffers like crazy when the bitrate goes much above 6 Mbps.
			transcoded video is silent if audio is AAC or PCM.

		Working audio:
			containers: FLAC, MP3

		Non-working audio:
			containers: APE
	-->
	<Detection>
		<HttpHeaders>
			<User-Agent>.*nPlayer.*</User-Agent>
		</HttpHeaders>
	</Detection>
	<Transcoding>
		<Video targetContainer="mpegts" targetVCodec="h264" forceVTranscoding="true" targetACodec="ac3" maxVBitrate="6000">
			<Matches container="*" vCodec="dvvideo"/>
			<Matches container="*" vCodec="h263"/>
			<Matches container="*" vCodec="h264" levelGreaterThan="5.0"/>
			<Matches container="*" vCodec="h264" profile="high_422"/>
			<Matches container="*" vCodec="h264" profile="high_444"/>
			<Matches container="*" vCodec="h264" profile="high_10"/>
			<Matches container="*" vCodec="h265"/>
		</Video>
		<Audio targetContainer="lpcm">
			<Matches container="ape"/>
		</Audio>
	</Transcoding>
</Profile>

Logitech Media Server and Squeezebox Boom support

I don't think I will be using LMS or my Squeezebox Boom to access audio via DLNA devices, but if I ever do, here is what each supports (as reported by UPnP Spy):

Logitech Media Server:

http-get:*:audio/L16;rate=44100;channels=2:DLNA.ORG_PN=LPCM,
http-get:*:audio/mp4:DLNA.ORG_PN=AAC_ISO;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01700000000000000000000000000000,
http-get:*:audio/mp4:DLNA.ORG_PN=AAC_ISO_192;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01700000000000000000000000000000,
http-get:*:audio/mp4:DLNA.ORG_PN=AAC_ISO_320;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01700000000000000000000000000000,
http-get:*:audio/mpeg:DLNA.ORG_PN=MP3;DLNA.ORG_OP=11;DLNA.ORG_FLAGS=01700000000000000000000000000000,
http-get:*:audio/mpeg:DLNA.ORG_PN=MP3X;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01700000000000000000000000000000,
http-get:*:audio/x-ms-wma:DLNA.ORG_PN=WMABASE;DLNA.ORG_OP=11;DLNA.ORG_FLAGS=01700000000000000000000000000000,
http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_TN;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=00f00000000000000000000000000000,
http-get:*:image/png:DLNA.ORG_PN=PNG_TN;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=00f00000000000000000000000000000,
http-get:*:audio/mp4:*,
http-get:*:audio/mpeg:*,
http-get:*:audio/x-flac:*,
http-get:*:audio/x-m4a-lossless:*,
http-get:*:audio/x-ogg:*

Squeezebox Boom:

http-get:*:audio/mpeg:*,
http-get:*:audio/L16;rate=8000;channels=1:*,
http-get:*:audio/L16;rate=8000;channels=2:*,
http-get:*:audio/L16;rate=11025;channels=1:*,
http-get:*:audio/L16;rate=11025;channels=2:*,
http-get:*:audio/L16;rate=12000;channels=1:*,
http-get:*:audio/L16;rate=12000;channels=2:*,
http-get:*:audio/L16;rate=16000;channels=1:*,
http-get:*:audio/L16;rate=16000;channels=2:*,
http-get:*:audio/L16;rate=22050;channels=1:*,
http-get:*:audio/L16;rate=22050;channels=2:*,
http-get:*:audio/L16;rate=24000;channels=1:*,
http-get:*:audio/L16;rate=24000;channels=2:*,
http-get:*:audio/L16;rate=32000;channels=1:*,
http-get:*:audio/L16;rate=32000;channels=2:*,
http-get:*:audio/L16;rate=44100;channels=1:*,
http-get:*:audio/L16;rate=44100;channels=2:*,
http-get:*:audio/L16;rate=48000;channels=1:*,
http-get:*:audio/L16;rate=48000;channels=2:*,
http-get:*:audio/vnd.dlna.adts:*,
http-get:*:audio/vnd.dlna.adts:*,
http-get:*:audio/mp4:*,
http-get:*:audio/mp4:*,
http-get:*:audio/mp4:*,
http-get:*:audio/x-ms-wma:*,
http-get:*:audio/x-ms-wma:*,
http-get:*:audio/x-ms-wma:*,
http-get:*:application/ogg:*,
http-get:*:audio/x-flac:*

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 video is always progressive scan, so it 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; see my notes about processing interlaced content with FFmpeg.

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" or "tv" (I think). If the metadata is wrong or missing, this is a "not my problem" kind of problem.

Example of a file which does mention it:

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

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?

That said, I think you can know just by the fact that all DV video is interlaced and is bottom field first, unless it is DVCPRO Progressive (in which case it is progressive) or DVCPRO HD (in which case it could be either progressive or interlaced). I found some DVCPRO HD clips at http://www.gvgdevelopers.com/concrete/products/k2/test_clips/ and they are reported as "dvvideo (dvh1 / 031687664)" for both PAL and NTSC, so maybe Serviio could just assume all dvvideo is interlaced unless 'dvvideo (dvh' is spotted.

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

If you deinterlace progressive content, the result is not horrible, but it's not ideal. It just makes motion blurrier.

Questions:

  • What happens when you blindly deinterlace telecine content? Are the results acceptable?
  • There is a related issue where FFmpeg may report an H.264 file's "tbr" frame rate as being double the "fps" rate. This happens when a progressive-scan input was converted to "PsF" interlaced for broadcast. Serviio tells FFmpeg to convert these videos to the tbr rate, which is incorrect. I don't know what effect this has on the video. See discussion and issue tracker. I am wondering whether you should deinterlace this type content.

Java updates

In the past, I had to completely shut down Serviio before updating Java (64-bit). See my notes on Java updates for more info.

Lately, I have not even had the 64-bit version of Java installed, and Serviio and Java both update just fine. *shrug*

Serviio disappeared after router change

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. Oh well.