Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Mediatomb transcoding mkv to PS3
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
enceladus
n00b
n00b


Joined: 13 Aug 2009
Posts: 13

PostPosted: Sat May 08, 2010 9:32 pm    Post subject: Mediatomb transcoding mkv to PS3 Reply with quote

Hi,

I have a PS3, a "server" running Mediatomb, and some x264 720p .mkv files (that need to be transcoded for the playstation). The .avi files from Mediatomb play just fine on the PS3.

Mediatomb is version 0.12.1, ffmpeg is 0.5_p20373, vlc is 1.0.6

With VLC transcoding, the PS3 will start to play the file but the colors will be wrong (black will be light gray, etc). Then it pauses and when it starts playing again it is all scrambled.

With ffmpeg transcoding, the first frame (maybe first couple of frames?) will show up on the PS3 before the PS3 puts up the pause icon. It does not play any farther than this. The colors are correct though.

I have also tried the mediatomb-transcode script from the Mediatomb wiki. On the Playstation, I get "Media Server Error: A network error has occurred. (00000000)"

"server" info: Athlon 64 X2 5000+ 2.6GHz, 2GB RAM
Linux server 2.6.28-hardened-r9 #1 SMP Tue Apr 27 16:14:34 EDT 2010 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 5000+ AuthenticAMD GNU/Linux

Does anyone have any ideas on how to get this working? Is the server just not beefy enough to transcode 720p on the fly? Perhaps I have overlooked something or just not found it yet?

Current config.xml
Code:
 <?xml version="1.0" encoding="UTF-8"?>
<config version="2" xmlns="http://mediatomb.cc/config/2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://mediatomb.cc/config/2 http://mediatomb.cc/config/2.xsd">
  <server>
    <ui enabled="yes" show-tooltips="yes">
      <accounts enabled="no" session-timeout="30">
        <account user="mediatomb" password="mediatomb"/>
      </accounts>
    </ui>
    <name>MediaTomb</name>
    <udn>uuid:3eeb92a5-4683-4a87-8a0d-4ba965b5faca</udn>
    <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>host</host>
        <database>database</database>
        <username>username</username>
        <password>password</password>
      </mysql>
    </storage>
    <protocolInfo extend="yes"/>
    <pc-directory upnp-hide="no"/>
    <extended-runtime-options>
      <ffmpegthumbnailer enabled="no">
        <thumbnail-size>160</thumbnail-size>
        <seek-percentage>10</seek-percentage>
        <filmstrip-overlay>no</filmstrip-overlay>
        <workaround-bugs>no</workaround-bugs>
        <image-quality>8</image-quality>
      </ffmpegthumbnailer>
      <mark-played-items enabled="no" suppress-cds-updates="yes">
        <string mode="prepend">*</string>
        <mark>
          <content>video</content>
        </mark>
      </mark-played-items>
      <lastfm enabled="no">
        <username>username</username>
        <password>password</password>
      </lastfm>
    </extended-runtime-options>
  </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="ogx" to="application/ogg"/>
        <map from="ogv" to="video/ogg"/>
        <map from="oga" to="audio/ogg"/>
        <map from="ogg" to="audio/ogg"/>
        <map from="ogm" to="video/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="mkv" to="video/x-matroska"/>
        <map from="mka" to="audio/x-matroska"/>
        <map from="avi" to="video/divx"/>
        <map from="m2ts" to="video/avc"/>
        <map from="cr2" to="image/raw"/>
        <map from="nef" to="image/raw"/>
   <map from="avi" to="video/divx"/>
      </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="video/ogg" as="ogg"/>
        <treat mimetype="audio/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/mp4" as="mp4"/>
        <treat mimetype="audio/mp4" as="mp4"/>
        <treat mimetype="video/divx" as="avi"/>
      </mimetype-contenttype>
    </mappings>
    <online-content>
      <YouTube enabled="no" refresh="28800" update-at-start="yes" purge-after="604800" racy-content="exclude" format="mp4" hd="no">
        <favorites user="NationalGeographic"/>
        <playlists user="PlayStation"/>
        <uploads user="Google"/>
        <standardfeed feed="most_viewed" time-range="today"/>
        <standardfeed feed="recently_featured" time-range="today"/>
      </YouTube>
    </online-content>
  </import>
  <transcoding enabled="yes">
    <mimetype-profile-mappings>
      <transcode mimetype="audio/ogg" using="audio2pcm"/>
      <transcode mimetype="audio/x-flac" using="audio2pcm"/>
      <transcode mimetype="video/ogg" using="video2mpeg"/>
      <transcode mimetype="video/x-flv" using="video2mpeg"/>
      <transcode mimetype="video/x-matroska" using="transcode-matroska"/>
    </mimetype-profile-mappings>
    <profiles>
      <profile name="audio2pcm" enabled="yes" type="external">
        <mimetype>audio/L16</mimetype>
        <accept-url>no</accept-url>
        <first-resource>yes</first-resource>
        <hide-original-resource>yes</hide-original-resource>
        <accept-ogg-theora>no</accept-ogg-theora>
        <sample-frequency>44100</sample-frequency>
        <audio-channels>2</audio-channels>
        <agent command="ffmpeg" arguments="-i %in -acodec pcm_s16be -ab 192k -ar 44100 -ac 2 -f s16be -y %out"/>
        <buffer size="1048576" chunk-size="131072" fill-size="262144"/>
      </profile>
      <profile name="video2mpeg" enabled="yes" type="external">
        <mimetype>video/mpeg</mimetype>
        <accept-url>no</accept-url>
        <first-resource>yes</first-resource>
        <hide-original-resource>yes</hide-original-resource>
        <accept-ogg-theora>yes</accept-ogg-theora>
        <sample-frequency>48000</sample-frequency>
        <audio-channels>2</audio-channels>
        <agent command="ffmpeg" arguments="-i %in -vcodec mpeg2video -b 4096k -r 25 -acodec mp2 -ab 192k -ar 48000 -ac 2 -async 1 -f dvd -threads 2 -y %out"/>
        <buffer size="10485760" chunk-size="262144" fill-size="524288"/>
      </profile>
      <profile name="transcode-matroska" enabled="yes" type="external">
        <mimetype>video/mpeg</mimetype>
        <accept-url>no</accept-url>
        <first-resource>yes</first-resource>
        <accept-ogg-theora>yes</accept-ogg-theora>
        <agent command="/etc/mediatomb/stupidps3" arguments="%in %out"/>
        <buffer size="10485760" chunk-size="262144" fill-size="524288"/>
      </profile>
    </profiles>
  </transcoding>
</config>


Transcode-matroska script (/etc/mediatomb/stupidps3):
Code:
#!/bin/bash

FFMPEG_PATH="/usr/bin/ffmpeg"
INPUT="$1"
OUTPUT="$2"
VIDEO_CODEC="mpeg2video"
VIDEO_BITRATE="4096k"
VIDEO_FRAMERATE="25"
AUDIO_CODEC="copy"
FORMAT="mpegts"

exec "${FFMPEG_PATH}" -i "${INPUT}" -vcodec ${VIDEO_CODEC} -b ${VIDEO_BITRATE} \
-r ${VIDEO_FRAMERATE} -acodec ${AUDIO_CODEC} -f ${FORMAT} - > "${OUTPUT}"


The VLC transcoding section I tried was:
Code:
      <profile name="video2mpeg" 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>
        <sample-frequency>48000</sample-frequency>
        <audio-channels>2</audio-channels>
        <agent command="vlc" arguments="%in -I dummy --sout=#transcode{vcodec=mp2v,vb=4096,fps=25,acodec=mpga,ab=192,samplerate=48000,channels=2,audio-sync,soverlay}:standard{access=file,mux=ps,dst=%out} vlc://quit"/>
        <buffer size="10485760" chunk-size="262144" fill-size="524288"/>
      </profile>


Thanks for your help.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 5100
Location: Saint Amant, Acadiana

PostPosted: Sat May 08, 2010 9:39 pm    Post subject: Reply with quote

Why you need to transcode. Can't it play MPEG-4 video (x264)? If Matroska is the problem all you need is to remux.
Back to top
View user's profile Send private message
enceladus
n00b
n00b


Joined: 13 Aug 2009
Posts: 13

PostPosted: Sun May 09, 2010 12:51 am    Post subject: Reply with quote

I don't need to transcode, it just seems like less effort down the road.

I have enough of these mkv files (and expect more) that I don't want to remux all of them, since it seems I need to remove the audio and video streams from the mkv and then put them into an mp4.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 5100
Location: Saint Amant, Acadiana

PostPosted: Sun May 09, 2010 1:25 am    Post subject: Reply with quote

Quote:
I don't need to transcode, it just seems like less effort down the road.


Transcoding is inevitable loss in quality, all codecs are lossy. Also, coding hi-def video is enormous work even for new multicore processors.

Quote:
I have enough of these mkv files (and expect more) that I don't want to remux all of them, since it seems I need to remove the audio and video streams from the mkv and then put them into an mp4.


So what's the point of transcoding?

Transcoding - recoding video and audio and remux.

Why not to do remux only? :roll:
Back to top
View user's profile Send private message
enceladus
n00b
n00b


Joined: 13 Aug 2009
Posts: 13

PostPosted: Sun May 09, 2010 2:06 am    Post subject: Reply with quote

I'm trying to avoid touching these files as much as possible. With transcoding, in theory, I can put them in the folder for mediatomb to pick up, and then when the PS3 goes to play them, it plays.

I don't see an easy way to remux a single file, let alone multiple files by multiple people on a regular basis. Ffmpeg keeps giving me non monotone timestamps errors when trying to go from mkv to mp4.

This server doesn't have an X server, so that seems to limit some of the tools available (I keep seeing avidemux mentioned).
Back to top
View user's profile Send private message
gregool
Guru
Guru


Joined: 26 Nov 2007
Posts: 336
Location: Lille

PostPosted: Sun May 09, 2010 8:59 am    Post subject: Reply with quote

hi,

i use mediatomb as well, here's the transcoding part of the config.xml

Code:
 <transcoding enabled="yes">
    <mimetype-profile-mappings>
      <transcode mimetype="video/x-flv" using="vlcmpeg"/>
      <transcode mimetype="application/ogg" using="vlcmpeg"/>
      <transcode mimetype="application/ogg" using="oggflac2raw"/>
      <transcode mimetype="audio/x-flac" using="oggflac2raw"/>
      <transcode mimetype="application/octet-stream" using="ffmpeg"/>
      <transcode mimetype="video/x-matroska" using="video-common"/>
      <transcode mimetype="audio/x-flac" using="audio-common"/>
      <transcode mimetype="video/x-divx" using="video-thumbnail"/>
    </mimetype-profile-mappings>
    <profiles>
      <profile name="oggflac2raw" enabled="no" type="external">
        <mimetype>audio/L16</mimetype>
        <accept-url>no</accept-url>
        <first-resource>yes</first-resource>
        <accept-ogg-theora>no</accept-ogg-theora>
        <agent command="ogg123" arguments="-d raw -f %out %in"/>
        <buffer size="1048576" chunk-size="131072" fill-size="262144"/>
     </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>     
<profile name="audio-common" enabled="yes" type="external">
      <mimetype>audio/x-wav</mimetype>
      <accept-url>yes</accept-url>
      <first-resource>yes</first-resource>
      <accept-ogg-theora>no</accept-ogg-theora>
      <agent command="mediatomb-transcode-audio" arguments="%in %out"/>
      <buffer size="1048576" chunk-size="131072" fill-size="262144"/>
     </profile>
      <profile name="vlcmpeg" enabled="no" type="external">
        <mimetype>video/mpeg</mimetype>
        <accept-url>yes</accept-url>
        <first-resource>yes</first-resource>
        <accept-ogg-theora>yes</accept-ogg-theora>
        <agent command="vlc" arguments="-I dummy %in --sout #transcode{venc=ffmpeg,vcodec=mp2v,vb=4096,fps=25,aenc=ffmpeg,acodec=mpga,ab=192,samplerate=44100,channels=2}:standard{access=file,mux=ps,dst=%out} vlc:quit"/>
        <buffer size="14400000" chunk-size="512000" fill-size="120000"/>
      </profile>
   <profile name="ffmpeg" enabled="yes" type="external">
   <mimetype>video/mpeg</mimetype>
   <accept-url>no</accept-url>
   <first-resource>yes</first-resource>
   <agent command="mediatomb-transcode-video" arguments="%in %out"/>
   <buffer size="1048576" chunk-size="131072" 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>
   <accept-ogg-theora>yes</accept-ogg-theora>
   <agent command="mediatomb-transcode-video-ffmpeg" arguments="%in %out"/>
   <buffer size="10485760" chunk-size="262144" fill-size="524288"/>
      </profile>   
</profiles>
  </transcoding>


Though this is actually working, the loss of quality led me to another solution: a gentoobox plugged directly on my screen.

at first i thought that a PS3 would be perfect for the job, i tried to remux my mkv file, which is actually working good but it took too many time, so i bought a new pc for that, and i don't regret it.
Back to top
View user's profile Send private message
enceladus
n00b
n00b


Joined: 13 Aug 2009
Posts: 13

PostPosted: Sun May 09, 2010 6:11 pm    Post subject: Reply with quote

gregool wrote:
hi,

i use mediatomb as well, here's the transcoding part of the config.xml

Code:
 <transcoding enabled="yes">
    <mimetype-profile-mappings>
      <transcode mimetype="video/x-matroska" using="video-common"/>
     </mimetype-profile-mappings>
    <profiles>
        <profile name="video-common" enabled="yes" type="external">
   <mimetype>video/mpeg</mimetype>
   <accept-url>yes</accept-url>
   <first-resource>yes</first-resource>
   <accept-ogg-theora>yes</accept-ogg-theora>
   <agent command="mediatomb-transcode-video-ffmpeg" arguments="%in %out"/>
   <buffer size="10485760" chunk-size="262144" fill-size="524288"/>
      </profile>   
</profiles>
  </transcoding>


Though this is actually working, the loss of quality led me to another solution: a gentoobox plugged directly on my screen.

at first i thought that a PS3 would be perfect for the job, i tried to remux my mkv file, which is actually working good but it took too many time, so i bought a new pc for that, and i don't regret it.


You're using a script (mediatomb-transcode-video-ffmpeg) for the transcoding. Can you share the script?

I'm trying to work with what I have, instead of buying new things. If I can't get the mkv's to work I'll either leave the PS3 out of it or go with lower quality avi files.

With remuxing, mkvextract seems to pull the streams out ok but ffmpeg doesn't seem to convert ac3 to aac and MP4Box won't put both streams into an mp4.
Back to top
View user's profile Send private message
gregool
Guru
Guru


Joined: 26 Nov 2007
Posts: 336
Location: Lille

PostPosted: Sun May 09, 2010 7:25 pm    Post subject: Reply with quote

here:

Code:
INPUT="$1"
OUTPUT="$2"
VIDEO_CODEC="mpeg2video"
VIDEO_BITRATE="4096k"
AUDIO_CODEC="mp2"
AUDIO_BITRATE="192k"
AUDIO_SAMPLERATE="48000"
AUDIO_CHANNELS="2"
FORMAT="dvd"
exec /usr/bin/ffmpeg -threads 2 -i "${INPUT}" -vcodec ${VIDEO_CODEC} -b ${VIDEO_BITRATE} \
-acodec ${AUDIO_CODEC} -ab ${AUDIO_BITRATE} -ar ${AUDIO_SAMPLERATE} -ac ${AUDIO_CHANNELS} \
-f ${FORMAT} - > "${OUTPUT}" #2>/dev/null


let us know how it goes :)
Back to top
View user's profile Send private message
enceladus
n00b
n00b


Joined: 13 Aug 2009
Posts: 13

PostPosted: Sun May 09, 2010 10:50 pm    Post subject: Reply with quote

That script works! And the quality is pretty good.

Some of the files play pretty smoothly for a little bit and then start stumbling; some of them are stumbling from the beginning. I'm assuming this is hardware limitation on the server, since it's all wired.

I'll worry about that later. After I stop being impressed that it works.
Back to top
View user's profile Send private message
gregool
Guru
Guru


Joined: 26 Nov 2007
Posts: 336
Location: Lille

PostPosted: Mon May 10, 2010 4:56 pm    Post subject: Reply with quote

that might be HW limitation indeed, never had any issues like this, you can try to lower the VIDEO_BITRATE a bit...

that could help :wink:
Back to top
View user's profile Send private message
enceladus
n00b
n00b


Joined: 13 Aug 2009
Posts: 13

PostPosted: Mon May 10, 2010 8:56 pm    Post subject: Reply with quote

Changing the video bitrate isn't preventing it from pausing/stumbling, it just slightly changed how far it went between pauses.
Back to top
View user's profile Send private message
gregool
Guru
Guru


Joined: 26 Nov 2007
Posts: 336
Location: Lille

PostPosted: Tue May 11, 2010 8:08 am    Post subject: Reply with quote

while the video is playing did you take a look at your server's load average?
Back to top
View user's profile Send private message
azp
Guru
Guru


Joined: 16 Nov 2003
Posts: 363
Location: Stockholm, Sweden

PostPosted: Thu Nov 25, 2010 6:55 pm    Post subject: Reply with quote

I've had scripts that has been working OK for me, but by updating them to what's in the links below they now work even better. The sound for MKV files has improved, especially for the 5.1 files.

This guy has posted his config files (in part I) and his improved script in part II, so just grab them and enjoy. I found them on the mediatomb-site.

Part I - http://www.vanalboom.org/node/14
Part II - http://www.vanalboom.org/node/16
Mediatomb page with some info - http://mediatomb.cc/dokuwiki/transcoding:transcoding

Good luck!
_________________
Weeks of coding can save you hours of planning.
Back to top
View user's profile Send private message
ludite
n00b
n00b


Joined: 28 Mar 2005
Posts: 52
Location: Whitby, Ontario, Canada

PostPosted: Fri Dec 24, 2010 7:51 am    Post subject: Reply with quote

Quote:

I have also tried the mediatomb-transcode script from the Mediatomb wiki. On the Playstation, I get "Media Server Error: A network error has occurred. (00000000)"


I too ran into this - after running mediatomb in debug I realized I was missing some dependent progs.

Specifically mediainfo LSDvd ffmpeg mencoder and XMLstarlet.

Do a search in the script for "which mencoder". You will see them all listed. I satisfied these and I have mkv on ps3.

Each of these is listed in the script Linked on the mediatomb page but no mention of them being required.
http://www.vanalboom.org/node/16
Back to top
View user's profile Send private message
biomecanoid
n00b
n00b


Joined: 13 Jul 2015
Posts: 2

PostPosted: Mon Jul 13, 2015 12:00 pm    Post subject: Previous messageNext messageBack to messages Mediatomb tran Reply with quote

Hello,

I realize that this is an ancient topic, but this is one of the most relevant i could find.

whenever i tried to playback movies with DTS on my Thomson UHD TV i get and error message "audio is not supported".

Can anyone help me transcode only the audio part on the MKV from DTS to AC3 ? the video is playing OK

I used to have miniDLNA but i moved to mediatomb and it works far better with my TV.

I installed mediatomb on a CentOS headless embedded board with dual code intel atom

Thanks
Back to top
View user's profile Send private message
azp
Guru
Guru


Joined: 16 Nov 2003
Posts: 363
Location: Stockholm, Sweden

PostPosted: Tue Jul 14, 2015 2:01 pm    Post subject: Re: Previous messageNext messageBack to messages Mediatomb t Reply with quote

biomecanoid wrote:
I used to have miniDLNA but i moved to mediatomb and it works far better with my TV.


That's interesting, for me it was the opposite! I can't remember why anymore (it was 3-4 years ago) but I moved from Mediatomb to MiniDLNA and haven't switched back ever since. I think that MiniDLNA had built-in transcoding and that's why I switched... Or if it had better support for automatic updating of the content via inotify?

I think you should try the scripts mentioned above, even though they transcode everything. Check if that works first. If it works, move on to modifying the scripts to use video passthrough (I think you should be able to figure out what to remove even though it's been years since I looked at it) and only transcode sound. I think at one point I had that type of script. They mention everything in the links I gave above, so steal that script and get hacking! :)
_________________
Weeks of coding can save you hours of planning.
Back to top
View user's profile Send private message
biomecanoid
n00b
n00b


Joined: 13 Jul 2015
Posts: 2

PostPosted: Tue Jul 14, 2015 2:22 pm    Post subject: Reply with quote

Hello,

miniDLNA has no transcoding whatsoever it just serves you the original files. On the other hand mediatomb does have transcoding.
mediatomb has better a better way of updating its library ( timed, inotify etc ) haven't seen any such settings on miniDLNA

When i switched to mediatomb my TV can playback movies (Without transcoding) that previously could not with miniDLNA.
The only problem that remains is that the TV doesn't support DTS audio and i would like to find a way to transcode ONLY the audio and leave the video as it is.

I just tried the script:

#!/bin/bash

FFMPEG_PATH="/usr/bin/ffmpeg"
INPUT="$1"
OUTPUT="$2"
VIDEO_CODEC="mpeg2video"
VIDEO_BITRATE="4096k"
VIDEO_FRAMERATE="25"
AUDIO_CODEC="mp2"
AUDIO_BITRATE="192k"
AUDIO_SAMPLERATE="44100"
AUDIO_CHANNELS="2"
FORMAT="dvd"

exec "${FFMPEG_PATH}" -i "${INPUT}" -vcodec ${VIDEO_CODEC} -b ${VIDEO_BITRATE} \
-r ${VIDEO_FRAMERATE} -acodec ${AUDIO_CODEC} -ab ${AUDIO_BITRATE} -ar ${AUDIO_SAMPLERATE} \
-ac ${AUDIO_CHANNELS} -f ${FORMAT} - > "${OUTPUT}"

And it works fine just my NAS has a Dual Core Intel Atom CPU which is too slow for the task.
Another drawback of the script is that it transcodes all MKV files regardless if they have DTS audio or not.

i want a script that will leave the video as it is and transcode only the DTS audio to AC3. ( if the audio is not DTS it should not transcode )

Then i think the NAS will be able to cope with the load since it will transcode only the audio and not the video as well.

I will try modifying the script and port back the results

if you have any ideas let me know

Thanks
Back to top
View user's profile Send private message
BT
Apprentice
Apprentice


Joined: 13 Jun 2004
Posts: 270

PostPosted: Wed Jul 15, 2015 6:05 am    Post subject: Reply with quote

The following transcoding profile may be useful:
Code:
      <profile name="audio2ac3" enabled="yes" type="external">
        <mimetype>video/x-matroska</mimetype>
        <accept-url>no</accept-url>
        <first-resource>yes</first-resource>
        <hide-original-resource>yes</hide-original-resource>
        <agent command="ffmpeg" arguments="-i %in -c:a ac3 -c:v copy -f matroska -threads 2 -y %out"/>
        <buffer size="10485760" chunk-size="262144" fill-size="524288"/>
      </profile>

This profile will transcode any audio track to AC3 and copy the video track. I tested it briefly with Kodi and it worked, although TVs are more finicky.

The only way to achieve what you really want is to create an elaborate transocding script, that will identify (with Mediainfo) the audio track and transcode only when DTS is detected. I have seen such scripts floating around on the Internet a while ago, so you should be able to find an existing script. However, since MediaTomb transcodes on-the-fly, you will loose the ability to seek the stream for all files processed in this way.

Instead I recommend that you manually transcode all DTS tracks to AC3 into a separate audio file:
Code:
ffmpeg -i video.mkv -c:a ac3 -f ac3 audio.ac3

Next remux (with MKVToolNix) the AC3 audio with the original MKV. This will leave you with an MKV that has two audio tracks, DTS and AC3. MediaTomb will serve both audio tracks to the TV. If the TV has a decent DLNA/UPnP client then it should select the audio track it supports i.e. AC3. If not, the TV will pick the first audio track, in which case you will want to ensure the AC3 track is the first audio track in the MKV file. Some TVs may even allow you to select the audio track to play.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
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