I'm hoping I can get an answer to two questions that are related to the above. I run a Windows 7 Media Center PC, (WMC), on which I watch and record DTV programs, (UK Standard Definition Freeview). I have also, in the last few months, started running Plex on a Ubuntu 12.10 based server - and I'm moving my video collection into Plex. But, I'd like to also watch my TV recordings via Plex. Specifically, I'd like to use a WD TV Live device to watch WTV files via Plex DLNA.
Having read the forums, I know there are problems with what I want to do, especially if I want to read the WTV directly, rather than using a trigger on the WMC PC to instigate a transcode/copy/delete in response to WMC events. I was hoping to:-
1. Mount \\win7pc\Public\Recorded TV using CIFS on the Ubuntu server, (so that the recorded WTV files appear local to Plex).
2. Write a custom Plex scanner to select the WTV files.
3. Write a custom metadata agent to read the metadata embedded in the WTV file.
4. Play the WTV via DLNA to the WD TV Live device.
I've had some success, but two principle problems, may mean I will need to use a different approach:-
1. The mount seemed to work fine, although it did cause very long delays in network file reads on the WMC PC. I think it was due to having foolishly created a circular reference. Whereby, the mount point of the WMC recordings directory on the Ubuntu server, was also part of a mapped drive on the WMC PC. But, I haven't investigated this further yet, and I've been using 8 test WTV files copied to the Ubuntu server for development purposes.
2. The scanner just picked up files with a WTV extension, (all the recordings are stored in one directory by WMC). I imported the recordings as movies, since they are a mix of show types, and the episode/season information isn't stored in the WTV metadata. The imported files play fine via HLS in the web player and via the previous version of the Android application. (If Plex allowed grouping by program name/recording time, as a substitution for season/episode number, then a TV shows like presentation might be possible).
3. I was able to use the information from http://wiki.multimedia.cx/index.php?title=WTV, (and to a lesser extent the source files for ffmpeg WTV support - I can't read C), to read the metadata in the WTV file. I wrote it in Java, (which I know), and then translated it into Python, (which I started learning just for this task). After a few tweaks, (plug-ins don't seem to support __private class variables), I've encountered the following error in the plug-ins log:-
2013-06-02 14:46:12,919 (7fbed0ff9700) : ERROR (__init__:93) - global name 'open' is not defined
and I latterly, read this entry in the Plex Plug-in Framework Documentation Release 2.1.1 on page 78:-
Plug-ins are generally not allowed to access the user’s file system directly, ...
which I'm assuming means I won't be able to read the metadata from the WTV files directly. My plugin needs these statements:-
f = open(self.filename, "rb") f.seek(offset) extract = f.read(length)
4. Play back of the WTV files via Plex DLNA on the WD TV Live can be a bit hit and miss. Since they play fine via HLS, I'm perplexed. I noticed that the dlnaclientprofiles.xml file has this line, which seems to be what is being used to transcode the WTV files for transmission via DLNA:-
Typical output for a Freeview WTV file, using ffmepg's -i option, is:-
Stream #0:0[0x28](eng): Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, s16, 256 kb/s (hearing impaired)
Stream #0:1[0x2a](eng): Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, s16, 256 kb/s
Stream #0:2[0x2b]: Video: mpeg2video (Main), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 15000 kb/s, 30.25 fps, 25 tbr, 10000k tbn, 50 tbc
Stream #0:3[0x2c](eng): Subtitle: dvb_subtitle
Stream #0:4[0x0]: Attachment: mjpeg
The default options to ffmpeg will often pick the hearing impaired track, and on occasion I think its picked the mjpeg as the video. A generic line like:-
ffmpeg -i "Pointless Celebrities_BBC ONE_2013_04_06_17_18_28.wtv" -map 0:a -map 0:v -vcodec copy -acodec copy Test.mpg
produces playable mpg files, but I couldn't see anything like these options for a dlnaclientprofiles.xml line, maybe something like:-
but perhaps this isn't possible.
In summary - I'd very much appreciate a developer telling me:-
1. Are metadata plug-ins forbidden from reading the media file, that's passed into the update() method, from disc?
2. Is it possible to extract/copy the contents of the WTV file for transmission, rather than transcode, via DLNA?
If I can find out the answers to these, I will know whether its worth pursuing my current plan, or looking for an alternative.
Thanks, and sorry for the long post!