#32 support transcode Video and Audio

open
nobody
None
5
2014-08-17
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 > >> (Page 1 of 4)
  • hiero
    hiero
    2011-02-27

    minidlna_transcode_1.0.18_samsung-support.patch was added

     
  • FifiTheReal
    FifiTheReal
    2011-03-04

    Great work!
    This works with my Samsung LE32C650 perfectly!

    Thank you!

     
  • This patch is great, but the video was running at a higher speed than the sound. To fix it I changed the mencoder argument -ofps from 30000/1001 to 24000/1001 and now it runs great.

    It would be a nice additional feature if you could tweak these settings through the .conf file.

    The file was played on a Sony BRAVIA KDL-46EX500

    Thanks for a great patch!

     
  • hiero
    hiero
    2011-03-06

    Thank you for the report.
    -ofps 30000/1001 works fine for my contents, and 24000/1001 breaks A/V sync.
    It seems the appropriate parameter depends on source stream.

    I will consider to specify parameters through the .conf file, however it may noy work if the parameter depends on source.

     
  • how shoul the patch be installed ? i am running centos 5.5

     
  • Hi,

    this works pretty well with my "new" Samsung C650. Chapter createn and all this.
    But I wonder why I don't have the transcoding working?
    Is there a special switch or compile command?

    Thanks so much!

     
  • hiero
    hiero
    2011-03-13

    ffmpeg and mencoder have to be installed to transcode.

    Ubuntu : sudo apt-get install ffmpeg mencode
    Fedora : sudo yum install ffmpeg mencode

    CentOS :
    I am not CentOS user. It seems some libraries and ffmpeg/mencoder are missing in CentOS standard repository. they have to be installed before build minidlna from other repositories.

     
  • P Walden
    P Walden
    2011-03-19

    Works on Fedora 14. You need to add a -logg library search to the minidlna link command in the Makefile.

    Can you redo this patch for 1.1.19?

     
  • hiero
    hiero
    2011-03-20

    support transcode Video and Audio patch against 1.0.19

     
  • hiero
    hiero
    2011-03-20

    patch against 1.0.19 is added.
    I tested on Ubuntu 10.04 and 11.04 alpha

    transcoder and transcode option can be specified in .conf file.
    read "minidlna.conf" after patch

     
  • P Walden
    P Walden
    2011-03-20

    I built and executed the 1.0.19 patch successfully on Fedora 14. Thank you!

    One thing I noticed while reviewing a log of the debug mode output is that the transcoder, in my case ffmpeg, gets run repeatedly many times for the same source video. From my blu-ray player I do not see any outward affect of this. So I would not have noticed it unless I reviewed the log.

    Do you know why the log has several transcoder exec's per video viewing?

     
  • HTTP-REQUESTs are issued twice for every play back from my Toshiba TV.
    I guess TV gets detailed parameters of the stream at the first time,
    then issues HTTP-REQUEST to start real play back .
    I think it depends on rendere's(TV's) implementasion of DLNA.

     
  • Is the -ofps option really necessary? I have material in 24p, 25p, 30p, 50i, 60i and removing the option was the only solution I found to keep video and audio in reasonable sync for all material.

     
  • It looks like it's only in exec_transcode that any differentiation is made between mencoder and ffmpeg, and only some extra options are added to produce the pipe.

    Why not make the transcoding program independent? As an example, the following would be specified in the config instead:

    transcode_video_transcoder=/usr/bin/mencoder
    transcode_video_options=(all previous options) -o -

    or

    transcode_video_transcoder=/usr/bin/ffmpeg
    transcode_video_options=-i (all previous options) pipe:1

    or

    transcode_video_transcoder=/usr/bin/vlc
    transcode_video_options=(new options)

    and so on...

     
  • Why is the PS3 not deinterlacing content that has been transcoded, when it is for non-transcoded material? Changing the harddup option to pp=fd deinterlaces the data before sending it, but it would be much better to let the PS3 do it.

     
  • P Walden
    P Walden
    2011-03-22

    The -ofps sets the frame per second to 30. At least my player expects 30fps. I tried it without the -ofps and I get sound but no picture.

     
  • hiero
    hiero
    2011-03-23

    hmmm, interesting

    for my contents and renderer(TV/BDP/players).
    mencoder with default(hard coded) options works best.
    other than "-ofps 30000/1001" makes AV sync issues.

    for some contents and renderer.
    "-ofps 24000/1001" is the best

    for some contents and renderer.
    not specify -ofps is the best

    for some contents and renderer.
    ffmpeg with default options is the best.

    At the first, I thought it is possible to find out
    almighty transcoder/options combination.
    But, it turns out impossible.

    by the way,
    following parameters are needed to be specified internally.

    - source path/filename
    - start time (position) in second
    - duration in second

    it is different how to specify them between transcoders.
    following might work for the transcoders including unknown one.

    define key words:
    $SOURCE, $STARTPOSITION, $DURATION

    user specify options as following.

    for mencoder
    transcode_video_transcoder=mencoder
    transcode_video_mencoder_options=-ss $STARTPOSITION -endpos $DURATION
    transcode_video_mencoder_options=-msglevel all=-1 -really-quiet -oac lavc
    transcode_video_mencoder_options=-of mpeg -mpegopts format=mpeg2:muxrate=8000:vbuf_size=1194:abuf_size=64 -vf scale=720:480,harddup -ovc lavc -channels 2
    transcode_video_mencoder_options=-lavdopts debug=0 -lavcopts autoaspect=1:vcodec=mpeg2video:vbitrate=8000:acodec=ac3:abitrate=128:keyint=18:vqscale=1:vqmin=2
    transcode_video_mencoder_options=-subdelay 20000 -ofps 30000/1001 -mc 0 -noskip -af lavcresample=48000 -srate 48000
    transcode_video_mencoder_options=-o- $SOURCE

    for ffmpeg
    transcode_video_transcoder=ffmpeg
    transcode_video_ffmpeg_options=-ss $STARTPOSITION -t $DURATION -i $SOURCE -v 0 -loglevel quiet -target ntsc-dvd pipe:1

     
  • Another possibility would be to use a wrapper (in which you could use mediainfo on $SOURCE to determine the best action, for example to deinterlace or not) like this:

    transcode_video_wrapper=transcode.sh $SOURCE $STARTPOSITION $DURATION

     
  • P Walden
    P Walden
    2011-03-24

    1. I was the one with the mencoder issue on some files and forced to use ffmpeg. Working the mplayer mail-list, It seems that dropping the -mc 0 and -noskip parameters seems eliminate the "Too many audio packets" failure I was seeing and the A/V sysnc issues have not come back. So for now I am back to using mencoder.

    2. With the transcoder config line suggested by lasa, ine would not necessarily need a wrapper. You substitute directly into a mencoder or ffmpeg command line. Also, I would go with shorter wildcards, more like gnome. e.g.

    transcode_command=ffmpeg -ss %b -t %e -i %s -sameq -target ntsc-dvd pipe:1

     
  • FifiTheReal
    FifiTheReal
    2011-03-26

    Hi hiero!

    The minidlna_transcode_1.0.19 patch not include samsung support. :-(
    Can you add into your transcode patch?

    Thank you!

    Bye, Fifi

     
  • Hello Fifi,

    I need samsung support patch against 1.0.19 for that,.

    hiero

     
  • hiero
    hiero
    2011-03-26

    Thank you for the suggestions, lasa and pcwalden.

    shell script can be use as following.
    transcode_video_transcoder=transcode.sh
    transcode_video_options=$STARTPOSITION $DURATION $SOURCE

    In order to reduce possibility of conflicts, I think it is better
    to define long key words. For example, there is a possibily some other
    transcoders define %b for their option.

    I am now wondering which is better to separate into to options or one.

    transcode_video_transcoder=mencoder
    transcode_video_ffmpeg_options=$STARTPOSITION $DURATION $SOURCE (options)

    or

    transcode_video_options=mencoder $STARTPOSITION $DURATION $SOURCE (options)

     
  • hiero
    hiero
    2011-03-27

    I uploaded "minidlna_transcode_1.0.19_samsung-support_20110327.patch".
    please try it.

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here


    Anonymous
    2011-03-27

    Thanks for the great patch. It is almost working. But I have the same problem as lkristensen mentioned in his comment "24000/1001 breaks A/V sync" with my Sony Bravia KDL-32V5500 TV.
    hieroun, you suggested some option for it, could you please tell me, what and where I need to change?

     
  • FifiTheReal
    FifiTheReal
    2011-03-27

    Hello hiero,

    Thank you for samsung support! It works fine!

    Bye, Fifi

     
  • Hello,

    I tested this patch on Ubuntu 9.04 with Samsung LE32B653 T2 TV. Some of the issues I had to deal with (DLNA Root menu not working, compilation problems), are reported here:
    https://sourceforge.net/tracker/?func=detail&atid=1121518&aid=3148380&group_id=243163 (comment 65, user mgiannakidis)

    In addition, I used the transcoding features introduced by this patch. I used the ffmpeg option. The default settings given in the .conf file, gave no improvement in my sample avis. While I was able to have sound on one of my two videos, after the transcoding patch, I had no sound in both videos.

    Could it be that I need different options for ffmpeg or a newer ffmpeg? How can I debug this problem?

    Thank you in advance

    Michalis

     
  • hiero
    hiero
    2011-03-28

    Hello,

    Following is how to change -ops option to "24000/1001".

    --------------------
    1) erase leading '#' of following lines in minidlna.conf

    #transcode_video_mencoder_options=

    2) replace "30000/1001" with "24000/1001" in fourth line
    of "transcode_video_mencoder_options=" lines.

     
  • hiero
    hiero
    2011-03-28

    Hello Michalis,

    I do not have Samsung TV. What I can do is import
    existing patch. It might be bettert to wait for stable
    samsung patch.

    Does mencoder works? mencoder is better for my contents and TV.
    An idea to check transcode is transcode contents off line
    and send it to TV via minidlna without on-the-fly transcoding.
    Adequate transcoder and options depends on contents and renderer(TV).
    It is very dufficult to suggest what transcoder and options works
    fine for each environment.

    heiro

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here


    Anonymous
    2011-03-28

    hieroun, thank you so much. I made changes as your instructions:

    Following is how to change -ops option to "24000/1001".

    --------------------
    1) erase leading '#' of following lines in minidlna.conf

    #transcode_video_mencoder_options=

    2) replace "30000/1001" with "24000/1001" in fourth line
    of "transcode_video_mencoder_options=" lines.

    But, after changing fourth line with "24000/1001" it shows "Playback error message" for all mkv files. Before it was playing mkv files which are in 30000/1001 encoded format.

     
  • P Walden
    P Walden
    2011-03-28

    Himali,

    Players are all different in how fussy they are about the format of the transcoded videos. It also depends on your location as your player may be either ntsc-dvd or pal-dvd. For example my Sony blu-ray player only support playing ntsc-dvd formatted mpeg2 files at 30fps. Your symptoms are similar to the ones I had when trying different frame rates. When I tried 24fps, I got sound but no picture. The mplayer document here gives a good description of what is needed to be compliant

    http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-vcd-dvd.html

    Also, you can run your chosen transcoder (e.g ffmpeg or mencoder) stand-alone and test the mpeg2 files it generates on your player. In that way you can finalize the options you need to configure in minidlna.conf.

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here


    Anonymous
    2011-03-28

    pcwalden Thank you so much for the guidance. I will test based on your suggestion.

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here


    Anonymous
    2011-03-29

    pcwalden

    I could solve my problem. Could you please share which argument worked for you. My problem is similar to yours.

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here


    Anonymous
    2011-03-29

    pcwalden

    I could not solve my problem. Could you please share which argument worked for
    you. My problem is similar to yours.

     
  • Hello Himali,

    Following options are related to AV sync.
    Try to remove them one by one to get better for your contents.
    harddup
    -mc 0
    -noskip
    -ofps 30000/1001
    though top three options improve A/V sync in general,
    they make side effects for some streams.

    hiero

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here


    Anonymous
    2011-03-31

    hiero,
    Thank you so much. I will test line by line.

     
    Last edit: Anonymous 2014-09-03
  • hiero
    hiero
    2011-04-03

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

     
  • hiero
    hiero
    2011-04-03

    "minidlna_transcode_1.0.19_20110402.tar.gz " is uploaded.

    followings are changed from "minidlna_transcode_1.0.19_20110320.patch".

    1. options for transcodeing are slightly changed, read minidlna.conf
    2. streams which continer is "ogg" are supported.
    3. This pacth can be build under Linux and Cygwin without any modification.
    read "How to build on Cygwin.txt" to build on Cygwin.
    4. 3246932 - Add option to show only contents of "Browse Folders" is imported.

     
  • Trying your latest patch, it is still locked down to using either mencoder or ffmpeg for the transcoding. For example, in minidlna.c there is a section:

    case TRANSCODE_V_TRANSCODER:
    strcpy(transcoder_video, ary_options[i].value);
    if(strstr(ary_options[i].value, "mencoder") != NULL)
    transcode_video = TRANSCODE_VIDEO_MENCODER;

    I still cannot see why this cannot be done in a generic fashion, where you only concatenate the "transcode_video_transcoder" and "transcode_video_options" from the config file.

    I want to be able to specify "mencoder/ffmpeg/or_any_filename_here/DISABLE" for the "transcode_video_transcoder" option. That way I am free to use whatever transcoder I want, or as in my case, my own script using mediainfo to pull information from $SOURCE and based on that select the optimal transcoding options.

     
  • hiero
    hiero
    2011-04-06

    I tested followings. They work.

    transcode_video_transcoder=/usr/bin/mencoder
    transcode_video_options=-ss $STARTPOSITION -endpos $DURATION
    transcode_video_options=(other options)
    transcode_video_options=-o - $SOURCE

    or

    transcode_video_transcoder=./transcode.sh
    transcode_video_options=$SOURCE $STARTPOSITION $DURATION

    It is not recomended, following also work.

    transcode_video_transcoder=
    transcode_video_options=/usr/bin/ffmpeg -ss $STARTPOSITION -t $DURATION -i $SOURCE -v 0 -loglevel quiet -target ntsc-dvd pipe:1

    hiero

     
  • hiero
    hiero
    2011-04-09

    I got the FFMPEG options which has good A/V sync.
    If anyone has A/V sync issue, it is worth trying.

    minidlna.conf ----------
    transcode_video_transcoder=ffmpeg
    transcode_video_options=-ss $STARTPOSITION -t $DURATION -i $SOURCE -v 0 -loglevel quiet -async 1 -target ntsc-dvd pipe:1
    ----------

     
  • P Walden
    P Walden
    2011-05-08

    hello hieroun

    The latest cvs download supports native mp4 and mkv on my Sony BDP-S370. I selectively merged your minidlna_transcode_1.0.19_20110320.patch into this latest download.

    It seems to work. the mpeg2 and mp4 files do not get transcoded, while the other file types do get transcoded.

    You may want to produce another transcode patch as there have been many significant changes since 1.0.19

     
  • hiero
    hiero
    2011-05-15

    hello pcwalden

    I uploaded the patch against CVS 384.

    hiero

     
  • hiero
    hiero
    2011-06-11

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

     
  • hiero
    hiero
    2011-06-11

    patch against 1.0.20 is added.
    I tested on Ubuntu 11.04 and Windows7/Vista/XP.

    transcoder and transcode option can be specified in .conf file.
    read "minidlna.conf" after patch

     
  • AzaToth
    AzaToth
    2011-06-12

    I would recommend you to remove all #If 1 litter

     
1 2 3 4 > >> (Page 1 of 4)