Ticket #296 (new enhancement)

Opened 2 years ago

Last modified 2 years ago

New Backend für VDR-Streaming

Reported by: Wallenstein Assigned to: dev
Priority: major Milestone: 0.7
Component: MediaServer Server Version: 1.0
Keywords: backend vdr Cc:

Description

Hello,

I am running a VDR-based video-recorder (http://www.linuxtv.org/vdrwiki/index.php/Main_Page).

Additionally I own a Sony Bravia KDL 40Wxxxx with DLNA support. Coherence was the best choice to bring the recordings of VDR onto the TV-Set (based on a slightly adapted fs_storage backend, adding some additional filetypes).

Now since HDTV is operated by the major channels in Germany, I wanted my VDR to stream (via coherence) live to my TV-Set.

To this end I have developed a new backend called vdrstream that uses the data of the streamdev-server VDR plugin, to set up a channellist for DLNA, and streams MPEG-TS video streams from VDR to the TV set.

Configuration is straight forward

<plugin active="yes">
  <uuid>97186c7f-4897-4905-ab5a-bbaa89c8042d</uuid>
  <streamdevURL>http://arctisserver2:3000/TS/</streamdevURL>
  <name>VDR Streaming</name>
  <backend>VDRStream</backend>
</plugin>

where streamdevURL is the URL of the port of the streamdev-Plugin.

The plugin required two changes in the upnp-Core:

  1. There is a problem with the proxyClientFactoryClass: Closing a stream by the DLNA renderer, was not properly propagated via the proxy to the server.

I have made the TCPconnector in upnp/core/utils.py l. 418 now an explicit attribute of the proxy, in order to attach a listener, that closes the backend stream.

This is part of a bugfix that might be considered to be included in the main branch.

  1. The Sony Bravia does not accept MPEG_TS_PAL but rather MPEG_TS_SD_EU_ISO. I have therefore changed this type in upnp/core/DIDLLite.py.

I'm unsure about the consequences for other devices. Perhaps somebody can help me.

One slight open problem is, that von HDTV-streams audio and video is not synchronized. (For standard TV streams it is OK). I have not yet found the reason for it.

The attached patch is for Coherence-0.6.6.x.

Feedback is welcome!

Attachments

vdrstream.patch (18.4 kB) - added by Wallenstein on 06.03.2010 16:13:16.
vdrStream Plugin Patch (based on 0.6.6.x)

Change History

06.03.2010 16:13:16 changed by Wallenstein

  • attachment vdrstream.patch added.

vdrStream Plugin Patch (based on 0.6.6.x)

06.03.2010 16:27:44 changed by Wallenstein

Sorry,

I forgot to formally mention that I put the patch under BSD license (or any other license, if suitable).

So you can integrate it in the main branch.

Wallenstein

06.03.2010 17:18:57 changed by jmsizun

Hi, at first, congrats!

got a bit through the code: looks ok to me. I guess at one stage, we'll have to go through the various backends and refactor them to share common code such as Container items, proxy objects.... If dev does not do it in the near future, I'll be happy to integrate this to the trunk.

For now, I'll be happy to know what you adapted in fs_storage to have it work with your tv. I am currently finalizing a 'framework' to be able to configure this in the config file instead of patching the code for each specific device.

Regards, Jean-Michel

06.03.2010 19:43:01 changed by Wallenstein

Hello Jean-Michel,

The change in fs_storage was "trivial".

VDR (<1.7.0( stored its recordings as mpeg-ps files with .vdr extensions. VDR (>=1.7.0) stores its recordings as mpeg-ts files with .ts extensions.

The first is simple. The second requires to activate them the video/mpegts mimetype, which might not be compatible with other deployments. I solved it initialy by automatic transcoding to mpeg-ps. But since BRAVIA accepts mpeg-ts I looked for a better solution.

Index: fs_storage.py
===================================================================
--- fs_storage.py       (Revision 1535)
+++ fs_storage.py       (Arbeitskopie)
@@ -20,6 +20,7 @@
 mimetypes.add_type('audio/x-m4a', '.m4a')
 mimetypes.add_type('video/mp4', '.mp4')
 mimetypes.add_type('video/mpegts', '.ts')
+mimetypes.add_type('video/mpeg', '.vdr')
 mimetypes.add_type('video/divx', '.divx')
 mimetypes.add_type('video/divx', '.avi')
 mimetypes.add_type('video/x-matroska', '.mkv')
@@ -774,6 +775,9 @@
                          'http-get:*:video/x-msvideo:*',
                          'internal:%s:video/mpeg:*' % self.server.coherence.hostname,
                          'http-get:*:video/mpeg:*',
+                         # TS
+                         'internal:%s:video/mpegts:*' % self.server.coherence.hostname,
+                         'http-get:*:video/mpegts:*',
                          'internal:%s:video/avi:*' % self.server.coherence.hostname,
                          'http-get:*:video/avi:*',
                          'internal:%s:video/divx:*' % self.server.coherence.hostname,

I thought about making the list of file-extensions and mimetypes configurable. Defaults should fall back to the original configuration.

I can provide you with an implementation, if you consider this interesting for integration in the main branch.

Wallenstein

(follow-up: ↓ 5 ) 23.05.2010 23:49:04 changed by jmsizun

you may have a look at the version in svn branch "client-device-config": it now supports customizing "extension to mimetype" mappings directly in config file.

still a development version though. :-)

(in reply to: ↑ 4 ) 28.05.2010 08:59:22 changed by f320v10

Hello Wallenstein,

I've tried your plugin with Samsung LE40B651T3 (with 100Mb ethernet onboard)and VDR ver. 1.7.12 without success.

There is some interesting patched firmware for Samsung TV sets:

* SamyGo

With this patch I could get ftp access to TV set and for example mount to virtual USB drive NFS drive from computer running VDR. And play practically any media from my vdr.

But for is very interesting to use my tv set as streamdev client.

When I used your plugin I could see all my channels from VDR but when I press enter there is an error: "Not supported file format" And plugin starts switching to next channels with the same error.

Then I mount (NFS) my home from VDR to virt.usb drive on TV set. And put following commands on VDR:

$ curl http://192.168.1.11:3000/PES/169 >ng.mpeg $ curl http://192.168.1.11:3000/TS/169 >ng.mpeg

Then I played them without problems with internal Samsung media player.

but with: $ curl http://192.168.1.11:3000/ES/169 >ng.mpeg

I got again error: "Not supported file format".

In my tv set I found the following file: /mtd_rwarea/dlna_web_root/dmr/ConnectionManager1.xml

There is variable in this file:

<stateVariable sendEvents="yes"> <name>SinkProtocolInfo?</name> <dataType>string</dataType> <defaultValue>http-get:*:video/vnd.dlna.mpeg-ttsLNA.ORG_PN=MPEG_TS_HD_NA,http-get:*:video/vnd.dlna.mpeg-ttsLNA.ORG_PN=MPEG_TS_HD_NA_T,http-get:*:video/vnd.dlna.mpeg-ttsLNA.ORG_PN=MPEG_TS_SD_NA,http-get:*:video/vnd.dlna.mpeg-ttsLNA.ORG_PN=MPEG_TS_SD_NA_T,http-get:*:video/mpegLNA.ORG_PN=MPEG_PS_NTSC,http-get:*:audio/L16;rate=44100;channels=1LNA.ORG_PN=LPCM,http-get:*:audio/L16;rate=44100;channels=2LNA.ORG_PN=LPCM,http-get:*:audio/L16;rate=48000;channels=1LNA.ORG_PN=LPCM,http-get:*:audio/L16;rate=48000;channels=2LNA.ORG_PN=LPCM,http-get:*:audio/mpegLNA.ORG_PN=MP3,http-get:*:image/jpegLNA.ORG_PN=JPEG_SM,http-get:*:image/jpegLNA.ORG_PN=JPEG_MED,http-get:*:image/jpegLNA.ORG_PN=JPEG_TN</defaultValue> </stateVariable>

So I tried to change in: coherence/upnp/core/DIDLLite.py

additional_info = DLNA.ORG_PN=MPEG_TS_SD_EU_ISO?+simple_dlna_tags to additional_info = DLNA.ORG_PN=MPEG_TS_SD_NA?+simple_dlna_tags

rebuild coherebce

But once again I got error: "Not supported file format"

Could give be any advice?