| View previous topic :: View next topic |
| Author |
Message |
azp Apprentice


Joined: 16 Nov 2003 Posts: 298 Location: Stockholm, Sweden
|
Posted: Fri Nov 13, 2009 11:24 pm Post subject: Subtitle transcoding with mediatomb (piggyback ride) |
|
|
Hi guys
For more than a year I've tried on and off to get subtitles to work with mediatomb, streaming to a PS3. There is a direct guide on the wiki on how to do it, but it just won't work for me. I hope I remember to mention everything, I've tried so many different things. This is the guide: http://mediatomb.cc/dokuwiki/transcoding:transcoding#piggybacking_subtitles_in_your_stream
I'm using ffmpeg for the ordinary mkv -> mpg transcoding, and that works great (after much headache and work), and I'm trying to use Mencoder to get the subtitles thing working. This is my config.xml:
| Code: | <?xml version="1.0" encoding="UTF-8"?>
<config version="1" xmlns="http://mediatomb.cc/config/1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mediatomb.cc/config/1
http://mediatomb.cc/config/1.xsd">
<server>
<ui enabled="yes">
<accounts enabled="no" session-timeout="30">
<account user="mediatomb" password="mediatomb"/>
</accounts>
</ui>
<name>MediaTomb</name>
<udn>uuid:51b10cef-e678-41be-8a0c-6d53e5243b2R</udn>
<interface>eth0</interface>
<home>/var/lib/mediatomb</home>
<webroot>/usr/share/mediatomb/web</webroot>
<storage>
<sqlite3 enabled="yes">
<database-file>mediatomb.db</database-file>
</sqlite3>
<mysql enabled="no">
<host>localhost</host>
<database>mediatomb</database>
<username>mediatomb</username>
<password>mediatomb</password>
</mysql>
</storage>
<protocolInfo extend="yes"/>
</server>
<import hidden-files="no">
<scripting script-charset="UTF-8">
<common-script>/usr/share/mediatomb/js/common.js</common-script>
<playlist-script>/usr/share/mediatomb/js/playlists.js</playlist-script>
<virtual-layout type="builtin">
<import-script>/usr/share/mediatomb/js/import.js</import-script>
</virtual-layout>
</scripting>
<mappings>
<extension-mimetype ignore-unknown="no">
<map from="mp3" to="audio/mpeg"/>
<map from="ogg" to="application/ogg"/>
<map from="asf" to="video/x-ms-asf"/>
<map from="asx" to="video/x-ms-asf"/>
<map from="wma" to="audio/x-ms-wma"/>
<map from="wax" to="audio/x-ms-wax"/>
<map from="wmv" to="video/x-ms-wmv"/>
<map from="wvx" to="video/x-ms-wvx"/>
<map from="wm" to="video/x-ms-wm"/>
<map from="wmx" to="video/x-ms-wmx"/>
<map from="m3u" to="audio/x-mpegurl"/>
<map from="pls" to="audio/x-scpls"/>
<map from="flv" to="video/x-flv"/>
<map from="avi" to="video/divx"/>
<map from="srt" to="video/subtitle"/>
<map from="mkv" to="video/x-matroska"/>
<map from="vob" to="video/iso"/>
<map from="VOB" to="video/iso"/>
<map from="iso" to="video/iso"/>
<map from="ISO" to="video/iso"/>
<map from="img" to="video/iso"/>
<map from="IMG" to="video/iso"/>
</extension-mimetype>
<mimetype-upnpclass>
<map from="audio/*" to="object.item.audioItem.musicTrack"/>
<map from="video/*" to="object.item.videoItem"/>
<map from="image/*" to="object.item.imageItem"/>
</mimetype-upnpclass>
<mimetype-contenttype>
<treat mimetype="audio/mpeg" as="mp3"/>
<treat mimetype="application/ogg" as="ogg"/>
<treat mimetype="audio/x-flac" as="flac"/>
<treat mimetype="image/jpeg" as="jpg"/>
<treat mimetype="audio/x-mpegurl" as="playlist"/>
<treat mimetype="audio/x-scpls" as="playlist"/>
<treat mimetype="audio/x-wav" as="pcm"/>
<treat mimetype="audio/L16" as="pcm"/>
<treat mimetype="video/x-msvideo" as="avi"/>
<treat mimetype="video/divx" as="avi"/>
<treat mimetype="video/x-divx" as="avi"/>
<treat mimetype="video/mp4" as="mp4"/>
<treat mimetype="audio/mp4" as="mp4"/>
</mimetype-contenttype>
</mappings>
</import>
<transcoding enabled="yes">
<mimetype-profile-mappings>
<transcode mimetype="application/ogg" using="audio-common"/>
<transcode mimetype="application/ogg" using="video-common"/>
<transcode mimetype="audio/x-flac" using="audio-common"/>
<transcode mimetype="video/x-flv" using="video-common"/>
<transcode mimetype="video/subtitle" using="mencoder-srt"/>
<transcode mimetype="video/x-matroska" using="video-common"/>
<transcode mimetype="video/subtitle" using="mencoder-srt"/>
<transcode mimetype="video/iso" using="video-common"/>
</mimetype-profile-mappings>
<profiles>
<profile name="mencoder-srt" enabled="yes" type="external">
<mimetype>video/mpeg</mimetype>
<agent command="/usr/local/bin/mediatomb-mencoder-srt" arguments="%in %out"/>
<buffer size="10485760" chunk-size="262144" fill-size="524288"/>
</profile>
<profile name="video-common" enabled="yes" type="external">
<mimetype>video/mpeg</mimetype>
<accept-url>yes</accept-url>
<first-resource>yes</first-resource>
<hide-original-resource>yes</hide-original-resource>
<accept-ogg-theora>yes</accept-ogg-theora>
<agent command="/usr/local/bin/mediatomb-transcode-video" arguments="%in %out"/>
<buffer size="10485760" chunk-size="262144" fill-size="524288"/>
</profile>
<!--<profile name="video-thumbnail" enabled="yes" type="external">
<mimetype>image/jpeg</mimetype>
<accept-url>yes</accept-url>
<thumbnail>yes</thumbnail>
<resolution>128x128</resolution>
<agent command="ffmpegthumbnailer" arguments="-i %in -o %out -s 128"/>
<buffer size="524288" chunk-size="512" fill-size="1024"/>
</profile>-->
</profiles>
</transcoding>
</config> |
This is my mediatomb-mencoder-srt:
| Code: | #!/bin/bash
srt="$1"
output="$2"
# filename must be of the form "movie name.XX[X].srt" or "movie name.srt"
base_name="$(echo $srt | sed 's/\..\{2,3\}\.srt$//' | sed 's/\.srt$//')"
extensions="avi mp4 mpg mov"
for ext in $extensions ; do
input=$base_name.$ext;
if [[ -e $input ]]; then break; fi
done
exec mencoder "$input" \
-oac lavc -ovc lavc -of mpeg \
-lavcopts vcodec=mpeg2video:keyint=1:vbitrate=200000:vrc_maxrate=9000:vrc_buf_size=1835 \
-vf harddup -mpegopts muxrate=12000 \
-sub "$srt" -font "/usr/share/fonts/dejavu/DejaVuSans.ttf" -subfont-autoscale 2 \
-o "$output" |
It should be like the guide on the wiki, except the path to the fonts. All I get on the PS3 is the ever-so-known "Unsupported format". So I tried if the script in a directory, and the output was:
| Code: | $ mediatomb-mencoder-srt Capote.srt Capote.mpg
MEncoder SVN-r29796-4.3.4 (C) 2000-2009 MPlayer Team
success: format: 0 data: 0x0 - 0x31fcd000
AVI file format detected.
[aviheader] Video stream found, -vid 0
[aviheader] Audio stream found, -aid 1
VIDEO: [DX50] 608x320 12bpp 23.976 fps 750.1 kbps (91.6 kbyte/s)
[V] filefmt:3 fourcc:0x30355844 size:608x320 fps:23.976 ftime:=0.0417
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 44100 Hz, 2 ch, s16le, 112.0 kbit/7.94% (ratio: 14000->176400)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
PACKET SIZE: 2048 bytes, deltascr: 36864
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 0
Opening video filter: [harddup]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================
Limiting audio preload to 0.4s.
Increasing audio density to 4.
[mpeg4 @ 0x1e5a920]Invalid and inefficient vfw-avi packed B frames detected
Movie-Aspect is 1.90:1 - prescaling to correct movie aspect.
videocodec: libavcodec (608x320 fourcc=3267706d [mpg2])
[mpeg2video @ 0x1e35270]MPEG1/2 does not support 2997/125 fps
Could not open codec.
FATAL: Cannot initialize video driver.
Exiting... |
I tried removing some of the arguments/options in the script, and if I removed all of the "-lavcopts vcodec=mpeg2video:keyint=1:vbitrate=200000:vrc_maxrate=9000:vrc_buf_size=1835 \
-vf harddup -mpegopts muxrate=12000 \" it did actually work and produced a file, but the PS3 still couldn't read the file.
Has anybody gotten this to work? I'm kind of tired after hours of config file mangling. _________________ Weeks of coding can save you hours of planning. |
|
| Back to top |
|
 |
azp Apprentice


Joined: 16 Nov 2003 Posts: 298 Location: Stockholm, Sweden
|
Posted: Sat Nov 14, 2009 12:01 am Post subject: |
|
|
I finally got it working by reading this thread . It seems like the
| Code: | | [mpeg2video @ 00A2F938]MPEG1/2 does not support 2997/125 fps |
is the thing to do something about. A comment in the forum says
| Quote: | Maybe I'm wrong but I think that mencoder recognize this framerates:
< 24000/1001 | 24 | 25 | 30000/1001 | 30 | 50 | 60000/1001 | 60 >
and I think there is the problem because he got this message
|
To solve this, put -ofps 24000/1001 on the line for 23.976 or -ofps 30000/1001 for 29.97 fps.
So by adding
it actually started working! I don't know what to do if the movie has another fps than 23.976 though... We'll come to that in the future I think. _________________ Weeks of coding can save you hours of planning. |
|
| Back to top |
|
 |
Heyleke n00b


Joined: 05 Aug 2003 Posts: 5
|
Posted: Tue Apr 17, 2012 6:07 pm Post subject: |
|
|
thx alot! even in 2012 the mediatomb wiki has this issue with the FPS error
did you ever got this working if the movie has another fps? (dynamic?) |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|