Menu

#32 support transcode Video and Audio

open
nobody
None
5
2023-08-16
2011-02-26
hiero
No

Hello,
This patch supports transcoding for both Video and Audio using mencoder/ffmpeg as transcoder.
This uses multiple <res> elements. It means minidlna present multiple media format for one stream.
For example, in case source stream is H.264/AAC, minidlna presents both H.264/AAC and MPEG2/AC3.
If a client (TV) supports only MPEG2/AC3, it select MPEG2/AC3 stream.
All the Video stream can be transcoded to MPEG2/AC3 (DVD) stream.
All the Audio stream can be transcoded to LPCM stream.

mencoder/ffmpeg is required to be installed.

I tested on Ubunts 10.04 and Fedora 12.

I hope this patch is helpful to the users who's TV only supports MPEG2 and LPCM.

This patch is for minidlna_1.0.18_src.tar.gz.
This patch also support Toshiba TV.

heiro

Discussion

<< < 1 2 3 4 5 .. 8 > >> (Page 3 of 8)
  • Leon Botha

    Leon Botha - 2011-07-06

    Hi hieroun

    I loaded your patch against 1.0.20 on my ClearOS and it all worked fine.
    I have noticed that i get a error message in the LOG file every time i connect with minidlna stating that it as received a showdown command "15" but minidlna is still working. Do you have any idea what this could be?

    Regards
    Leon

     
  • hiero

    hiero - 2011-07-08

    Hello Leon,

    Would you show the LOG around the error message.

    hiero

     
  • Leon Botha

    Leon Botha - 2011-07-10

    Hi hieroun

    While watching video's, the log is filled with the following:

    [2011/07/09 12:06:15] minidlna.c:157: warn: received signal 15, good-bye
    [2011/07/09 12:09:03] minidlna.c:157: warn: received signal 15, good-bye
    [2011/07/09 23:18:49] minidlna.c:157: warn: received signal 15, good-bye
    [2011/07/09 23:24:36] minidlna.c:157: warn: received signal 15, good-bye
    [2011/07/10 00:18:16] minidlna.c:157: warn: received signal 15, good-bye
    [2011/07/10 00:56:46] minidlna.c:157: warn: received signal 15, good-bye
    [2011/07/10 00:56:46] upnpsoap.c:1542: warn: SoapMethod: Unknown: X_SetBookmark

    Regard

    Leon

     
  • hiero

    hiero - 2011-07-16

    Hello Leon,

    Thank you for the information.

    In some cases, SIGTERM is issued to kill the transcode process.
    The log messages are written when the SIGTERM is received in the transcode process.
    But the message should be as following:
    [2011/07/12 12:26:05] upnphttp.c:1314: warn: received signal 15
    because the signal handler in the process is replaced with "sigterm_child()" in upnphttp.c.

    I think the log can be ignored, if minidlna still works, because the logs are written in the transcode process which should be killed.
    Anyway, I should check more.

    hiero

     
  • Leon Botha

    Leon Botha - 2011-07-22

    Hi hieroun

    Any update on the error i have ?
    [2011/07/22 18:00:09] minidlna.c:157: warn: received signal 15, good-bye
    [2011/07/22 18:00:09] upnpsoap.c:1542: warn: SoapMethod: Unknown: X_SetBookmark
    [2011/07/22 18:00:09] upnpsoap.c:1590: warn: Returning UPnPError 401: Invalid Action
    [2011/07/22 18:00:28] minidlna.c:157: warn: received signal 15, good-bye
    [2011/07/22 18:01:01] minidlna.c:157: warn: received signal 15, good-bye
    [2011/07/22 18:01:01] upnpsoap.c:1542: warn: SoapMethod: Unknown: X_SetBookmark
    [2011/07/22 18:01:01] upnpsoap.c:1590: warn: Returning UPnPError 401: Invalid Action
    [2011/07/22 18:02:02] minidlna.c:157: warn: received signal 15, good-bye
    [2011/07/22 18:02:49] minidlna.c:157: warn: received signal 15, good-bye
    [2011/07/22 18:02:49] upnpsoap.c:1542: warn: SoapMethod: Unknown: X_SetBookmark
    [2011/07/22 18:02:49] upnpsoap.c:1590: warn: Returning UPnPError 401: Invalid Action
    It seems that Minidlna does not set a bookmark in my case, any idea where i can look to see why?
    I have a ClearOS box.

    Leon

     
  • hiero

    hiero - 2011-07-27

    Hello Leon,

    Do the following warnings appear only after the transcode patch is applied?
    I do not think the patch makes influence to these process.

    [2011/07/22 18:01:01] upnpsoap.c:1542: warn: SoapMethod: Unknown: X_SetBookmark
    [2011/07/22 18:01:01] upnpsoap.c:1590: warn: Returning UPnPError 401:Invalid Action

    hiero

     
  • Leon Botha

    Leon Botha - 2011-07-27

    Hi hieroun

    Yes, i had Ver. 1.0.20 running fine before the patch.
    This is new after the patch.

    Leon

     
  • hiero

    hiero - 2011-07-27

    Hello Leon,

    OK, I will investigate it.

    hiero

     
  • Leon Botha

    Leon Botha - 2011-07-27

    Hi hieroun

    How do you "snoop" the messages between minidlna and your tv?
    I am a bit new to this. Want to see if i can understand what is going on.
    I have a Win. XP box, still new to Linux as well

    You can email me on leonbotha.69@gmail.com if you want
    Leon

     
  • hiero

    hiero - 2011-07-27

    Hello Leon,

    I think you are using Samsung TV for client.
    I got the information from the internet resources
    that Samsung product issues "X_SetBookmark" for resume function.
    MiniDLNA does not support "X_SetBookmark" function.
    The warnings shows:
    - the client requests "X_SetBookmark".
    - MiniDLNA does not know it, so returns UPnPError401:Invalid Action.

    As a result, resume does not work on the client.

    Easier way to "snoop" is using -d option on MiniDLNA like
    minidlna -d
    You can get more information than log file.

    If you want to capture all of the messages between MiniDLNA and cliens,
    wireshark is the best, though it is not so easy to use it.

    BTW.
    "minidlna_transcode_1.0.19_samsung-support_20110327.patch" supports "X_SetBookmark".

    hiero.

     
  • Anonymous

    Anonymous - 2011-07-28

    I'm trying this patch on my Ubuntu 11.04 with a Panasonic TX-P42VT20 tv. Some files that were not possible to play before work with this patch and ffmpeg, but others do not. I have a few mkv files with H264 video and DTS audio that still don't work. I started minidlna with the -d option in order to have a look. It seems there is no attempt to transcode the file, but the tv can't play it. How is it determined what files should be transcoded? Do I need to provide further information?

     

    Last edit: Anonymous 2014-03-16
  • hiero

    hiero - 2011-07-28

    At first, please read above "Details".

    With this patch, minidlna shows both non-transcoded and transcoded resources to the client(TV) for each title.
    In the message with -d option, followings may be seen.

    ----------
    &lt;dc:title&gt;(Title of the file)&lt;/dc:title&gt
    ...
    &lt;res ... protocolInfo= ... &lt;/res&gt
    &lt;res ... protocolInfo= ... MPEG_PS_NTSC ... &lt;/res&gt
    ----------

    The first "protocolInfo" shows the original one and second(MPEG_PS_NTSC) shows the transcoded one.
    Then the client selects the resource of the two.

    If the client selects the transcoded resource, ffmpeg message is displayed in the minidlna message.

    It may be helpful to show the last 30 lines of the message after a mkv file is selected.

     
  • Anonymous

    Anonymous - 2011-07-28

    Thank you for the response. Below I have enclosed some debug output. I interpret the info as the client choosing the original, not transcoded variant. Is that correct? The original file contains DTS audio though, something that the tv media player does not support. Can it be seen that that there is DTS audio in the communication?

    I hope that this problem is relevant to the patch in question.

    <?xml version="1.0" encoding="utf-8"?>
    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:BrowseResponse xmlns:u="urn:schemas-upnp-org:service:ContentDirectory:1"><Result>&lt;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/"&gt;
    &lt;item id="64$2$1D$0" parentID="64$2$1D" restricted="1"&gt;&lt;dc:title&gt;f-justgowithit720&lt;/dc:title&gt;&lt;upnp:class&gt;object.item.videoItem&lt;/upnp:class&gt;&lt;dc:date&gt;2011-07-16T11:13:46&lt;/dc:date&gt;&lt;res size="5858955800" duration="1:56:29.974" resolution="1280x688" protocolInfo="http-get:*:video/x-matroska:DLNA.ORG_OP=01;DLNA.ORG_CI=0"&gt;http://192.168.1.73:8200/MediaItems/6051.mkv&lt;/res&gt;&lt;res duration="1:56:29.974" resolution="720x480" protocolInfo="http-get:*:video/mpeg:DLNA.ORG_PN=MPEG_PS_NTSC;DLNA.ORG_OP=10;DLNA.ORG_CI=1;DLNA.ORG_FLAGS=01500000000000000000000000000000"&gt;http://192.168.1.73:8200/MediaItems/TranscodeVideo/NTSC/6051.mkv&lt;/res&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;</Result>
    <NumberReturned>1</NumberReturned>
    <TotalMatches>1</TotalMatches>
    <UpdateID>27</UpdateID></u:BrowseResponse></s:Body></s:Envelope>

    [2011/07/28 15:57:31] minidlna.c:1339: debug: HTTP connection from 192.168.1.71:60223
    [2011/07/28 15:57:31] upnphttp.c:276: debug: Range Start-End: 0 - -1
    [2011/07/28 15:57:31] upnphttp.c:168: debug: Client found in cache. [type 100/entry 0]
    [2011/07/28 15:57:31] upnphttp.c:853: debug: HTTP REQUEST: GET /MediaItems/6051.mkv HTTP/1.1
    Host: 192.168.1.73:8200
    Range: bytes=0-
    transferMode.dlna.org: Streaming
    Connection: keep-alive

    [2011/07/28 15:57:31] upnphttp.c:2217: info: Serving DetailID: 6051 [/mnt/2TBDisk/My Shared Folder/Torrents/Just.Go.With.It.2011.720p.BluRay.x264--Felony/f-justgowithit720.mkv]
    [2011/07/28 15:57:31] upnphttp.c:2401: info: Following is the response
    HTTP/1.1 206 OK
    Content-Type: video/x-matroska
    Content-Length: 5858955800
    Content-Range: bytes 0-5858955799/5858955800
    transferMode.dlna.org: Streaming
    Accept-Ranges: bytes
    Connection: close
    Date: Thu, 28 Jul 2011 13:57:31 GMT
    EXT:
    realTimeInfo.dlna.org: DLNA.ORG_TLAG=*
    contentFeatures.dlna.org: DLNA.ORG_OP=01;DLNA.ORG_CI=0
    Server: Ubuntu/11.04 DLNADOC/1.50 UPnP/1.0 MiniDLNA/1.0

    [2011/07/28 15:57:31] upnphttp.c:2410: info: last_file.mime=video/x-matroska
    [2011/07/28 15:57:31] upnphttp.c:1225: info: start sendfile, offset=0, end=5858955799
    [2011/07/28 15:57:31] minidlna.c:1339: debug: HTTP connection from 192.168.1.71:51200
    [2011/07/28 15:57:31] upnphttp.c:276: debug: Range Start-End: 0 - -1
    [2011/07/28 15:57:31] upnphttp.c:168: debug: Client found in cache. [type 100/entry 0]
    [2011/07/28 15:57:31] upnphttp.c:853: debug: HTTP REQUEST: GET /MediaItems/6051.mkv HTTP/1.1
    Host: 192.168.1.73:8200
    Range: bytes=0-
    transferMode.dlna.org: Streaming
    Connection: keep-alive

    [2011/07/28 15:57:31] upnphttp.c:2196: info: !!!! kill(SIGTERM() childpid = 23852
    [2011/07/28 15:57:31] upnphttp.c:2217: info: Serving DetailID: 6051 [/mnt/2TBDisk/My Shared Folder/Torrents/Just.Go.With.It.2011.720p.BluRay.x264--Felony/f-justgowithit720.mkv]
    [2011/07/28 15:57:31] minidlna.c:157: warn: received signal 15, good-bye
    [2011/07/28 15:57:31] upnphttp.c:2401: info: Following is the response
    HTTP/1.1 206 OK
    Content-Type: video/x-matroska
    Content-Length: 5858955800
    Content-Range: bytes 0-5858955799/5858955800
    transferMode.dlna.org: Streaming
    Accept-Ranges: bytes
    Connection: close
    Date: Thu, 28 Jul 2011 13:57:31 GMT
    EXT:
    realTimeInfo.dlna.org: DLNA.ORG_TLAG=*
    contentFeatures.dlna.org: DLNA.ORG_OP=01;DLNA.ORG_CI=0
    Server: Ubuntu/11.04 DLNADOC/1.50 UPnP/1.0 MiniDLNA/1.0

     
  • hiero

    hiero - 2011-07-28

    Thank you for the log.
    Yes, the original(non-transcoded) is selected.

    Following can be known from the log.

    For the title of "f-justgowithit720", following two resources are presented from minidlna.

    ----------
    protocolInfo="http-get:*:video/x-matroska:DLNA.ORG_OP=01;DLNA.ORG_CI=0"
    http://192.168.1.73:8200/MediaItems/6051.mkv

    protocolInfo="http-get:*:video/mpeg:DLNA.ORG_PN=MPEG_PS_NTSC;DLNA.ORG_OP=10;DLNA.ORG_CI=1;DLNA.ORG_FLAGS=01500000000000000000000000000000"
    http://192.168.1.73:8200/MediaItems/TranscodeVideo/NTSC/6051.mkv
    ----------

    Following is the request from the TV:
    ----------
    [2011/07/28 15:57:31] upnphttp.c:853: debug: HTTP REQUEST: GET
    /MediaItems/6051.mkv HTTP/1.1
    ----------
    This shows the TV selects the original one.

    The information in protocolInfo is very limited. Especially MKV case, there is no Video/Audio codec types.
    This is a weak point of "multiple <res> elements", because clients can make a mistake to select resource which codec is not supported.

    BTW,
    I checked "Operating Instructions" of TX-P42VT20B. There described "MKV (Matroska Video) files are not supported by DLNA".
    It is interesting why the TV selects the MKV.

     
  • Anonymous

    Anonymous - 2011-07-29

    Thank you again for the explanation. Now I understand what is happening. It is a shame that the protocol is defined in such a way that the renderer cannot with confidence automatically choose a format that is supported. I guess the only options are to live with the occational problem like this or to have manual configuraton for each renderer in minidlna (which would be a pain in the ...).

    The tv does play matroska files through DLNA. As long as the used codecs are supported, it works fine. The manual doesn't seem to be correct regarding this!

     
  • Anonymous

    Anonymous - 2011-07-30

    Hi,

    Is it possible to have the patch against 1.0.21 version?

    Regards

     
  • hiero

    hiero - 2011-08-07

    support transcode Video and Audio patch against 1.0.21 support Linux and Cygwin

     
  • hiero

    hiero - 2011-08-07

    patch against 1.0.21 is uploaded.
    I tested on Ubuntu 11.04 and Windows7/Vista/XP.

     
  • Leon Botha

    Leon Botha - 2011-08-30

    Hi hieroun
    Are you planning an update against 1.0.22?

     
  • goro69

    goro69 - 2011-09-01

    Is this patch make difference bеtwееn PAL or NTSC system, or coding of input files. My audio is 10 sec. behind video.

     
  • hiero

    hiero - 2011-09-01

    Though currently only NTSC is supported, try to replace option as following.
    This may work.

    if using mencoder,
    replace "-ofps 30000/1001" with "-ofps 25"

    if using ffmpeg,
    "-target ntsc-dvd" with "-target pal-dvd"

     
  • hiero

    hiero - 2011-09-01

    support transcode Video and Audio patch against 1.0.22 support Linux and Cygwin

     
  • hiero

    hiero - 2011-09-01

    patch against 1.0.22 is uploaded.
    I tested on Ubuntu 11.04 and Windows7/Vista/XP.

     
  • Anonymous

    Anonymous - 2011-09-02

    Would it be possible to add an option to force transcoding? An more advanced extension could be to force transcoding for certain containers and/or codecs. This would serve as a workaround for the problem where the tv selects a file which it doesn't support due to lack of information about the codec.

    Another improvement that would be really good would be to enable audio transcoding to mp3 - my tv won't play the lpcm (yes, really!)

     
  • hiero

    hiero - 2011-09-10

    force transcoding:
    For this purpose, it is necessity to omit presenting original(not transcoded) profile.
    Though it is possible to support it technically, there is a problem.
    It is necessity to modify database structure, but it is not preferable.
    I will look for another way.

    transcoding to mp3:
    I will upload it soon.

     
<< < 1 2 3 4 5 .. 8 > >> (Page 3 of 8)

Log in to post a comment.