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 .. 8 > >> (Page 1 of 8)
  • 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!

     
  • hiero

    hiero - 2011-03-05

    merged transcode and Basic Samsung TV xxC650 support v2 patch

     
  • Laust Kristensen

    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.

     
  • hiero

    hiero - 2011-03-06

    support transcode Video and Audio

     
  • Nobody/Anonymous

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

     
  • Nobody/Anonymous

    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?

     
  • Nobody/Anonymous

    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.

     
  • Lars Rönnbäck

    Lars Rönnbäck - 2011-03-22

    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.

     
  • Lars Rönnbäck

    Lars Rönnbäck - 2011-03-22

    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...

     
  • Lars Rönnbäck

    Lars Rönnbäck - 2011-03-22

    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

     
  • Lars Rönnbäck

    Lars Rönnbäck - 2011-03-24

    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

     
  • Nobody/Anonymous

    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)

     
1 2 3 .. 8 > >> (Page 1 of 8)

Log in to post a comment.