Twonky and Transcoding

General discussion about the media server. Feature requests. Hints, tips and tricks.
Locked
Steevo25
Posts:11
Joined:Wed Apr 18, 2012 12:43 pm
AV Hardware:TeraStation III
Twonky and Transcoding

Post by Steevo25 » Wed Apr 25, 2012 1:46 pm

Hi All,

Hopefully there is something you can help me with.

I now have Twonky 6.0.0.39 running on my NAS box and it does just about everything I need. I had to downgrade from Twonky 7 back to 6 as due to the fact I have a lot of media (2000 videos) with the groupid being removed there was no way I could set my navigation tree up to make things easy to find.

Anyway, my wife decided we needed a new TV for the kitchen. We managed to pick up a Sony Bravia KDL-22EX320 on a good deal and it did what we wanted. However, I cannot seem to stream any videos to it (music and photos work fine). I tried many formats (AVI, MKV etc with different codecs XviD, H.264 etc). The only format that streamed were MPEG.

I have now setup transcoding on the server using FFMpeg etc and the MPEG-2 function has become available on the transcoding menu.

Now I am assuming that if I tick the box then Twonky will transcode everything to MPEG-2 to every device. That is not really what I want. I just want video to the Sony Bravia transcoded. All my other devices I want Twonky to carry on doing exactly what it was doing before as it works perfectly.

Does anyone know the steps I need to do to tell Twonky to transcode all AVI files and MKV files to MPEG-2 just for the Sony Bravia. In the 'Media Receivers' section it does pick the TV up as a Sony Bravia profile but presently streaming to it I just get a blank screen. It looks as if it will play but just sits there with a black screen forever.

I created the ffmpeg-avi-mpeg.location file and took a look at the clients.db but did not understand the clients.db file at all. Is there any documentation for this.

Many thanks in advance.

User avatar
phibertron
Posts:1566
Joined:Sun Jan 30, 2011 5:52 pm
AV Hardware:Hardware
========
WHS - HP Ex495
PS3
XBOX 360
iTouch - Gen 2 and Gen 3
PSP - 3000

Encoders
========
Handbrake
x264
ffmpeg
mencoder

Tagging
======
mp3tag

Re: Twonky and Transcoding

Post by phibertron » Wed Apr 25, 2012 5:56 pm

I took a look at this

this line in which "FR" is not documented
is either telling it to do a mime translation
or to do a transcode to one of those two dlna profiles


clients.db

>>
NA:Sony Bravia
HH:BRAVIA
XM:DLNA15
TR:JPEGORG,JPEG160x160,JPEG640x480,JPEG1024x768,JPEG1920x1080
FR:video/avi:MPEG_PS_PAL,video/avi:MPEG_PS_NTSC
DB:FIX


And took a look at this
and can only see two references related to mpeg video

transcoding.db

PAL,mpg,video/mpeg,MPEG_PS_PAL,720,576
MPEG,mpg,video/mpeg,MPEG_PS_NTSC,720,480

I have played with transcoding a little bit, to see what I could and could not get away with

1.
ensure that you have ffmpeg installed, and actually working, test it via commandline
as if you do not do that there is no point in testing anything else, right

2.
I would then try this in the clients.db

TR:JPEGORG,JPEG160x160,JPEG640x480,JPEG1024x768,JPEG1920x1080,MPEG
FR:video/avi:MPEG

3. make sure you have the ffmpeg.location file created in cgi-bin with a path to ffmpeg

for ex: /usr/bin/ffmpeg

4. make sure you have the ffmpeg-any-mpeg.desc transcode file created in cgi-bin

exec: ffmpeg -i $infile -vcodec mpeg2video -vb 1000k $outfile
from=video/*
to=video/mpeg
asynchronous
priority=idle
viewtopic.php?f=2&t=10627
viewtopic.php?f=2&t=9353
viewtopic.php?f=2&t=9408
viewtopic.php?f=2&t=9416
viewtopic.php?f=2&t=9424
viewtopic.php?f=2&t=9364
viewtopic.php?f=2&t=9497

User avatar
parnott
Posts:326
Joined:Mon Sep 20, 2010 9:55 pm
AV Hardware:Twonky, WDTV Live, XBMC (Linux & Windows)

Re: Twonky and Transcoding

Post by parnott » Wed Apr 25, 2012 10:47 pm

Let's start with the basics. What NAS device do you have? What CPU type and clock speed does it have?

Most NAS devices do not have the performance necessary for video transcoding.

Steevo25
Posts:11
Joined:Wed Apr 18, 2012 12:43 pm
AV Hardware:TeraStation III

Re: Twonky and Transcoding

Post by Steevo25 » Thu Apr 26, 2012 8:24 am

Many thanks for your replies.

The NAS is a Buffalo TS-XL.

One thing I got wrong above is the transcoding has to go to MPEG-TS not straight MPEG. The Sony requires H.264 and AC3 in the .ts format. It's the only one that seems to work on the Sony via streaming. All formats work fine on a USB stick but the Sony is very fussy what it streams.

User avatar
parnott
Posts:326
Joined:Mon Sep 20, 2010 9:55 pm
AV Hardware:Twonky, WDTV Live, XBMC (Linux & Windows)

Re: Twonky and Transcoding

Post by parnott » Thu Apr 26, 2012 10:29 pm

If this is your NAS device (http://buffalo.nas-central.org/wiki/Cat ... astationV3) forget about video transcoding. It won't happen in real-time and will take ages (like days, weeks, etc.) in background.

Steevo25
Posts:11
Joined:Wed Apr 18, 2012 12:43 pm
AV Hardware:TeraStation III

Re: Twonky and Transcoding

Post by Steevo25 » Tue May 15, 2012 12:00 am

Many thanks for your replies and my apologies for not coming back sooner. I have been busy copying all my DVDs (2000 or so) so that I am able to stream them.

You are quite correct, my NAS box is far too slow to do any type of transcoding. I tried converting a 90 minute film using ffmpeg and the whole process from the command line took nearly 3 hours so no way can it do it in real time.

What I have now done is moved Twonky away from the NAS box and am using my NAS box for just purely storage. Twonkly is now running on a Windows 7 PC and the libraries just point to the NAS box.

The PC should be more than powerful enough to do exactly what I want. It is a Core i7 quad-core PC with fast SATA drives and 8GB RAM. I converted the same file on there using ffmpeg and it took just a matter of minutes so perfectly capable of transcoding on the fly. In-fact, I even tried a 110 minute HD movie and this converted in under 30 minutes.

Anyway, back to the task in hand.

I have now installed ffmpeg into c:\ffmpeg\bin and edited the ffmpeg.location file. The transcoding options are now enabled.

What I need to do now is transcode any file that is streamed using the Sony Bravia profile only. Anything else should be sent un-modified. The command line that works is

ffmpeg -i in.avi -sameq -vcodec mpeg2video -f mpegts -acodec copy out.ts

Now my question, what do I ned to edit and change to get this to work.

The Twonky version is 6.0.39. I cannot upgrade any higher than that as my layout used the groupid function which was removed in version 7 and without it, there is just not enough flexibility to put my files in small enough lists to view on the devices (they run out of buffer space because there are too many files). I have approx. 2100 video files and 9000 music files.

Any help would be much much appreciated.

User avatar
phibertron
Posts:1566
Joined:Sun Jan 30, 2011 5:52 pm
AV Hardware:Hardware
========
WHS - HP Ex495
PS3
XBOX 360
iTouch - Gen 2 and Gen 3
PSP - 3000

Encoders
========
Handbrake
x264
ffmpeg
mencoder

Tagging
======
mp3tag

Re: Twonky and Transcoding

Post by phibertron » Tue May 15, 2012 1:49 am

If -vcodec copy or -acodec copy is used
it will work but...
from my experiences in doing so to mp4, havent tried other containers
what will happen is that you will have to wait for the entire file to transcode
before it will be available for streaming
I did testing on this a while back, and it does work on 6.x to the ps3, if you can wait for it to finish
If you dont mind the audio being transcode, then it will work as intended

While I havent ever tried transcode to .TS
It should work if we add this in the to the transcode database

transcode.db

Code: Select all

MPEGTS,ts,video/vnd.dlna.mpeg-tts,MPEG_TS
Edit the client.db profile for the bravia to use avi to our MPEGTS added to transcode.db

clients.db

Code: Select all

FR:video/avi:MPEGTS
Create a desc file in the cgi-bin file for this

ffmpeg-avi-ts.desc
( I removed the -acodec copy, as to test without it first)

Code: Select all

# transcode video
#(c) 2008 by PacketVideo
exec: ffmpeg -i $infile  -sameq -vcodec mpeg2video -f mpegts $outfile
# capabilities
from=video/avi
to=video/mpeg
asynchronous
priority=idle
Note:
Note sure if to=video/mpeg
should be to=video/vnd.dlna.mpeg-tts
in the above desc file or not

If had to do it what your looking to do, the above is changes, is where I would start

Why do you need to use the TS container why not MPG container?
viewtopic.php?f=2&t=10627
viewtopic.php?f=2&t=9353
viewtopic.php?f=2&t=9408
viewtopic.php?f=2&t=9416
viewtopic.php?f=2&t=9424
viewtopic.php?f=2&t=9364
viewtopic.php?f=2&t=9497

Steevo25
Posts:11
Joined:Wed Apr 18, 2012 12:43 pm
AV Hardware:TeraStation III

Re: Twonky and Transcoding

Post by Steevo25 » Tue May 15, 2012 9:23 am

Thank you for all your help. I will give this a try after work.

Just to be clear, you say that if I use -vcodec copy OR -acodec copy then the file will have to transcode to completion before it can be streamed (i.e. pre-transcode). But if I do not use either of those options then it will transcode on the fly?

The only reason for using .ts is that I know it's a combination that works. I tried lots of different combinations but that was the only one I could easily get to stream to the Bravia. It's a very fussy bit of kit. I don't think I have tried an MPG container. What would be the ffmpeg option to try an MPG container? I only found that .ts worked when I was trying other media streaming software (Mezzmo to be exact). This worked perfectly on the Bravia and looking at it, the ffmpeg command line was exactly what it was using so thats the one I tried.

User avatar
phibertron
Posts:1566
Joined:Sun Jan 30, 2011 5:52 pm
AV Hardware:Hardware
========
WHS - HP Ex495
PS3
XBOX 360
iTouch - Gen 2 and Gen 3
PSP - 3000

Encoders
========
Handbrake
x264
ffmpeg
mencoder

Tagging
======
mp3tag

Re: Twonky and Transcoding

Post by phibertron » Tue May 15, 2012 3:52 pm

Steevo25 wrote:Just to be clear, you say that if I use -vcodec copy OR -acodec copy then the file will have to transcode to completion before it can be streamed (i.e. pre-transcode). But if I do not use either of those options then it will transcode on the fly?
Yup, that has been my experience
Its hard to say what the root cause of why it is, not sure it is completely container biased or not
But beleive it has something to do with the way the file is being indexed/interleaved
and or something to do with headers that dont allow it play until finished

If the TS adjustments dont pan out
Try to the MPEG way that is pretty much already in place for the bravia at present
viewtopic.php?f=2&t=10627
viewtopic.php?f=2&t=9353
viewtopic.php?f=2&t=9408
viewtopic.php?f=2&t=9416
viewtopic.php?f=2&t=9424
viewtopic.php?f=2&t=9364
viewtopic.php?f=2&t=9497

Locked