dlnatoad icon indicating copy to clipboard operation
dlnatoad copied to clipboard

External subtitles

Open lalkmim opened this issue 10 years ago • 5 comments

Do you think of supporting external subtitles (SRT files)? There are some apps that support this.

http://www.supportforum.philips.com/en/showthread.php?2704-DLNA-streaming-support-for-external-subtitle-files-srt&p=33833&viewfull=1#post33833

http://sourceforge.net/p/minidlna/discussion/879956/thread/6ae154be

lalkmim avatar Mar 13 '14 02:03 lalkmim

For reference, the samples linked above are:

<item id="V_T^INI_65^V_9" parentID="V_T^INI_65" restricted="1">
    <dc:title>Arzak Rhapsody 01</dc:title>
    <upnp:class>object.item.videoItem</upnp:class>
    <res protocolInfo="http-get:*:video/x-msvideoLNA.ORG_PN=AVI;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.O RG_FLAGS=01500000000000000000000000000000">http://192.168.178.27:8895/resource/9/MEDIA_ITEM/AVI*0</res>
    <res protocolInfo="http-get:*:image/jpegLNA.ORG_PN=JPEG_TN;DLNA.ORG_OP=00;DLNA.ORG_CI=1;DL NA.ORG_FLAGS=00D00000000000000000000000000000">http://192.168.178.27:8895/resource/9/COVER_IMAGE</res>
    <res protocolInfo="http-get:*:text/srt:*">http://192.168.178.27:8895/resource/9/SUBTITLE.srt</res>
</item>
<DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" xmlns:sec="http://www.sec.co.kr/dlna" xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/">
<item id="1_10_22_23" parentID="1_10_22" restricted="0">
    <res sec:acodec="dca" sec:vcodec="h264" duration="01:58:09" resolution="1920x800" size="8520673418" protocolInfo="http-get:*:video/x-mkv:DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01500000000000000000000000000000">http://192.168.0.191:17679/FileProvider/M$7089000/O$1/S$41.srt/P$/I$video/x-mkv/41</res>
    <res resolution="160x66" size="3471" protocolInfo="http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_TN;DLNA.ORG_CI=1;DLNA.ORG_FLAGS=00D00000000000000000000000000000">http://192.168.0.191:17679/FileProvider/M$0/O$0/S$/P$JPEG_TN/I$image/jpeg/44</res>
    <res resolution="640x266" size="22419" protocolInfo="http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_SM;DLNA.ORG_CI=1;DLNA.ORG_FLAGS=00D00000000000000000000000000000">http://192.168.0.191:17679/FileProvider/M$0/O$0/S$/P$JPEG_SM/I$image/jpeg/43</res>
    <sec:CaptionInfoEx sec:type="srt">http://192.168.0.191:17679/SubtitleProvider/41.SRT</sec:CaptionInfoEx>
    <upnp:playbackCount>0</upnp:playbackCount><sec:dcmInfo>CREATIONDATE=1321142739,FOLDER=The Change-Up,BM=72</sec:dcmInfo><sec:modifiationDate>2011-11-13T01:05:39</sec:modifiationDate>
    <sec:preference>0</sec:preference><dc:date>2011-11-13T01:05:39</dc:date><upnp:class>object.item.videoItem</upnp:class><dc:title>The.Change-Up.UNRATED.1080p.BluRay.x264-BLOW</dc:title><sec:MetaFileInfo sec:type="mta">http://192.168.0.191:17679/FileProvider/45</sec:MetaFileInfo><upnp:objectUpdateID>26</upnp:objectUpdateID><sec:initUpdateID>26</sec:initUpdateID>
</item>
</DIDL-Lite>
<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/">
<item id="64$6$0" parentID="64$6" restricted="1">
    <dc:title>The.Change-Up.UNRATED.1080p.BluRay.x264-BLOW</dc:title>
    <upnp:class>object.item.videoItem</upnp:class>
    <dc:date>2011-11-13T01:05:39</dc:date>
    <res size="8520673418" duration="1:58:09.088" bitrate="192000" sampleFrequency="48000" nrAudioChannels="6" resolution="1920x800" protocolInfo="http-get:*:video/x-matroska:DLNA.ORG_OP=01;DLNA.ORG_CI=0">http://192.168.0.198:8200/MediaItems/29.mkv</res>
</item>
</DIDL-Lite>

Basically just add the srt as an extra stream resource. One example includes an CaptionInfoEx element, but seems not all renderers need this. My one quick test shows that BubbleUPNP on Android does not need CaptionInfoEx.

As a first pass at solving this, I will just add the extra stream resource and see what renderers work ok.

haku avatar Mar 13 '14 10:03 haku

Also note, this first test impl assume that the srt files have the exact same path except for extension and that the extension is lower case. e.g.

/foo/bar/video.mp4
/foo/bar/video.srt

If this works OK I will fix up the requirement for lower case extensions.

haku avatar Mar 13 '14 10:03 haku

Nice! I believe the first example is more "standard" and should be the one to follow, as I use MiniDLNA at home and it works well with my devices (Samsung TV and 8player on iPad).

lalkmim avatar Mar 13 '14 13:03 lalkmim

Also, not exactly a pattern, but there are some players that can understand multiple external subtitles, as long as they are .en.srt, .pt.srt, etc.

Don't know much about this because I just use one subtitle, but I've seen multiple subtitles around a few times.

/foo/bar/video.mp4
/foo/bar/video.en.srt
/foo/bar/video.es.srt
/foo/bar/video.pt.srt

lalkmim avatar Mar 14 '14 15:03 lalkmim

Subtitle files ending like '.en.srt' might now work ok. Some testing required.

haku avatar Jun 08 '14 14:06 haku