Transcoding divx => mpeg2 for SONY Bravia KDL-37V5800

General discussion about the media server. Feature requests. Hints, tips and tricks.
Locked
nexulm
Posts:5
Joined:Mon Oct 10, 2011 10:44 pm
AV Hardware:Linux Debian 6.0 Atom based NAS/Mediaserver
SONY Bravia 37V5800
Transcoding divx => mpeg2 for SONY Bravia KDL-37V5800

Post by nexulm » Mon Oct 10, 2011 11:11 pm

Hi,

looking the forum I've seen a lot discussions and problems to get video streaming working for Sony Bravia!
I'm using latest TwonkyServer v6.0.37 on a Debian 6.0 Linux installation (Atom Dual Processor) and transcoding is enabled.
First of all I've modified /usr/local/twonkymedia/cgi-bin/ffmpeg.location to /usr/bin to enable transcoding. As some source are talking about that transcoding doesn't work if twonkyserver is running as daemon I've modified the startup script /etx/init.d/twonkyserver from...
"$TWONKYSRV"
...to...
dtach -n /tmp/twonkymedia "$TWONKYSRV"

What's working fine with TwonkyServer v6.0.37 now is, that all my files divx, mpg2, mkv, ... are shown. But if I try to show one of the divx-files the Screen is black and the message"Playback not available" appears.
I'm using the default .desc files within /usr/local/twonkymedia/cgi-bin!
What I expect is that ffmpeg-divx-mpeg.desc includes all ffmpeg settings which are necessary for on the fly transcoding divx => mpeg2.
If not, how can I solve this issue. If I use the command line "ffmpeg -i $infile -vcodec mpeg2video -b 1000K $outfile" from the file directly the mpeg2 output file is running fine.
I'm also surprised why several video files (maybe all in a few days) are transcoded automatically in /var/twonkymedia/twonkymedia/db/cache/xxx . What is the trigger for that if I didn't request to transcode them by my television remote control?

Regards
Michael

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

Re: Transcoding divx => mpeg2 for SONY Bravia KDL-37V5800

Post by parnott » Tue Oct 11, 2011 7:34 pm

I think you are being a bit over optimistic that an Atom processor could do realtime transcoding from DIVX to MPEG2.

You could however try this test-
1) Choose a DIVX file with a play duration at least 15min or more.
2) Time how long it takes ffmpeg to process the file
(i.e. ffmpeg -i divxinfilename -vcodec mpeg2video -b 1000K mpegoutfilename, don't use /dev/null as the outfilename)
3) If it takes ffmpeg close to or longer to process the file than the play duration then you can't do realtime transcoding.

nexulm
Posts:5
Joined:Mon Oct 10, 2011 10:44 pm
AV Hardware:Linux Debian 6.0 Atom based NAS/Mediaserver
SONY Bravia 37V5800

Re: Transcoding divx => mpeg2 for SONY Bravia KDL-37V5800

Post by nexulm » Tue Oct 11, 2011 9:07 pm

[quote="parnott"]
2) Time how long it takes ffmpeg to process the file
(i.e. ffmpeg -i [b][i]divxinfilename[/i][/b] -vcodec mpeg2video -b 1000K [b][i]mpegoutfilename[/i][/b], don't use /dev/null as the outfilename)
[/quote]
I did the test today with a avi (mpeg4) file with a duration of 00:30:37 and encoding was finished after 195.04sec. Not so bad, or? That's IMO not the problem.
I miss a working ffmpeg-xxx-mpg.desc file which starts transcoding my AVI , mpeg4, xvid, divx files!?!
Maybe it's also a problem due to a missing configuration in the transcoding.db file???

Nevertheless; I don't understand why the twonkyserver has generated more than 40GB of mpeg video files in my .../db/cache directory since last night. OK, if I navigate into this directory the mpeg2 files which are based on my .avi files are working, but I expect only on the fly transcoding and than only one file while transcoding of the current played file is active.

...and my cache directory size increase is ongoing till the HDD is full!?!...

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

Re: Transcoding divx => mpeg2 for SONY Bravia KDL-37V5800

Post by parnott » Wed Oct 12, 2011 12:48 am

I apologize ahead for sounding sceptical. But 195.04sec to transcode a 00:30:37 video from avi/mp4 to mpeg2 seems difficult to believe. I just wish both my Atom machines could achieve that performance and if it proves correct how I can achieve that performance.

So just to rule out other factors, please use the MediaInfo tool (download from here- http://mediainfo.sourceforge.net/en) and analyze both the input and output files used in your ffmpeg transcode. Post the tree/text output of both files so we can see what went in and what came out from the ffmpeg transcode.

As for the cache, the Twonky ini file has a cachemaxsize parameter which I believe controls how big the cache can be. I have never had to use it because my cache directory has only ever contained files that were generated for seeking through mpeg files. At least that is what I have always guessed the *.mpg.seek files were used for.

nexulm
Posts:5
Joined:Mon Oct 10, 2011 10:44 pm
AV Hardware:Linux Debian 6.0 Atom based NAS/Mediaserver
SONY Bravia 37V5800

Re: Transcoding divx => mpeg2 for SONY Bravia KDL-37V5800

Post by nexulm » Wed Oct 12, 2011 6:30 am

OK, no problem. Mediainfo was already installed via apt-get on my linux machine for investigating this issue.
The mediainfo output of the .avi file is:
General
Complete name : CC2_053.avi
Format : AVI
Format/Info : Audio Video Interleave
File size : 24.6 MiB
Duration : 30mn 37s
Overall bit rate : 112 Kbps
Writing application : Lavf51.12.1

Video
ID : 0
Format : MPEG-4 Visual
Format profile : Simple@L1
Format settings, BVOP : No
Format settings, QPel : No
Format settings, GMC : No warppoints
Format settings, Matrix : Default (H.263)
Codec ID : XVID
Codec ID/Hint : XviD
Duration : 30mn 37s
Width : 512 pixels
Height : 288 pixels
Display aspect ratio : 16:9
Frame rate : 25.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Compression mode : Lossy
Writing library : Lavc51.40.4

Audio
ID : 1
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 3
Mode : Joint stereo
Mode extension : MS Stereo
Codec ID : 55
Codec ID/Hint : MP3
Duration : 30mn 36s
Bit rate mode : Constant
Bit rate : 96.0 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Compression mode : Lossy
Stream size : 21.0 MiB (86%)
Alignment : Aligned on interleaves

The mediainfo output of the transcoded .mpg file is:
General
Complete name : CC2_053.mpg
Format : MPEG-PS
File size : 25.1 MiB
Duration : 3mn 15s
Overall bit rate : 1 077 Kbps

Video
ID : 224 (0xE0)
Format : MPEG Video
Format version : Version 2
Format profile : Main@Main
Format settings, BVOP : No
Format settings, Matrix : Default
Duration : 3mn 15s
Bit rate mode : Variable
Bit rate : 992 Kbps
Width : 512 pixels
Height : 288 pixels
Display aspect ratio : 16:9
Frame rate : 25.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.269
Stream size : 23.1 MiB (92%)

Audio
ID : 192 (0xC0)
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 2
Duration : 3mn 15s
Bit rate mode : Constant
Bit rate : 64.0 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Compression mode : Lossy
Stream size : 1.49 MiB (6%)


OK, what I see now is that 195.04 sec is the duration of the output file and not the time for transcoding!?! But why isn't the output file as long as the input file if I'm using this command line???:
ffmpeg -i CC2_053.avi -vcodec mpeg2video -b 1000K CC2_053.mpg

By the way the 3min outout file isn't a working .mpg. A lot pixel errors which I don't have if I'm uing other parameter on ffmpeg.

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

Re: Transcoding divx => mpeg2 for SONY Bravia KDL-37V5800

Post by parnott » Wed Oct 12, 2011 4:44 pm

It looks like the conversion is failing for some reason. The duration of the input file and output file should be the same but they are not. The input file is Duration : 30mn 37s and the output is Duration : 3mn 15s

You could try and turn on verbose logging and see if there is any hint in the output that would explain what is happening. The command line would be-
ffmpeg -v 7 -i CC2_053.avi -vcodec mpeg2video -b 1000K -y CC2_053.mpg

You could also try another way of doing the conversion-
ffmpeg -v 7 -i CC2_053.avi -target dvd -y CC2_053.mpg

The '-target dvd' parameter should ensure that the output file is consistent with the way DVD VOB files are mastered. You could also try -target pal-dvd or -target ntsc-dvd depending the desired video standard. Yours look to be PAL.

nexulm
Posts:5
Joined:Mon Oct 10, 2011 10:44 pm
AV Hardware:Linux Debian 6.0 Atom based NAS/Mediaserver
SONY Bravia 37V5800

Re: Transcoding divx => mpeg2 for SONY Bravia KDL-37V5800

Post by nexulm » Wed Oct 12, 2011 7:26 pm

[quote="parnott"]It looks like conversion is failing for some reason. The duration of the input file and output file should be the same but they are not. The input file is Duration : 30mn 37s and the output is Duration : 3mn 15s[/quote]
That's right and I don't know the reason.but the verbose level doesn't give any further hint for it.

Nevertheless; I try another file which was transcoded correctly within 6min (duration 30min):
Complete name : CC2_054.avi
Format : AVI
Format/Info : Audio Video Interleave
File size : 218 MiB
Duration : 30mn 10s
Overall bit rate : 1 009 Kbps
Writing application : Lavf51.12.1

Video
ID : 0
Format : MPEG-4 Visual
Format profile : Simple@L1
Format settings, BVOP : No
Format settings, QPel : No
Format settings, GMC : No warppoints
Format settings, Matrix : Default (H.263)
Codec ID : XVID
Codec ID/Hint : XviD
Duration : 30mn 10s
Bit rate : 900 Kbps
Width : 512 pixels
Height : 288 pixels
Display aspect ratio : 16:9
Frame rate : 25.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.244
Stream size : 194 MiB (89%)
Writing library : Lavc51.40.4


MPEG2:
General
Complete name : CC2_054.mpg
Format : MPEG-PS
File size : 442 MiB
Duration : 30mn 10s
Overall bit rate : 2 049 Kbps

Video
ID : 224 (0xE0)
Format : MPEG Video
Format version : Version 2
Format profile : Main@Main
Format settings, BVOP : No
Format settings, Matrix : Default
Format settings, GOP : M=1, N=12
Duration : 30mn 10s
Bit rate mode : Variable
Bit rate : 1 816 Kbps
Width : 512 pixels
Height : 288 pixels
Display aspect ratio : 16:9
Frame rate : 25.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.493
Stream size : 392 MiB (89%)

Audio
ID : 192 (0xC0)
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 2
Duration : 30mn 10s
Bit rate mode : Constant
Bit rate : 192 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Compression mode : Lossy
Stream size : 41.4 MiB (9%)


I'm still looking for a working .desc file. How is the correct naming for the .desc file? How must be the content and what must be configured anywhere else from the original installation file?

My ffmpeg-avi-mpg.desc file in the cgi-bin directory looks like:
# transcode video (mpeg4 to mpeg2)
exec: ffmpeg -i $infile -b 12000k -threads 2 -ab 192k -f dvd $outfile
# capabilities
from=video/avi
to=video/mpeg
asynchronous

But I'm not sure if it is used if I select the CCxxx.avi or any other .avi file from the Twonky Server on the SONY Bravia KDL-37V5800! Still the same behaviour as described in the starting post,

nexulm
Posts:5
Joined:Mon Oct 10, 2011 10:44 pm
AV Hardware:Linux Debian 6.0 Atom based NAS/Mediaserver
SONY Bravia 37V5800

Re: Transcoding divx => mpeg2 for SONY Bravia KDL-37V5800

Post by nexulm » Fri Oct 14, 2011 8:00 am

OK, as I don't have or find a working configuration for my SONY Bravia KDL-37V5800 and the tronkyserver package doesn't include a valid ffmpeg_avi_mpg.desc I've switched to the PS3MediaServer (http://www.ps3mediaserver.org) yesterday.
Wow, within <30min. I've a working DLNA server with transcoding. Now, my Sony TV can play most of my videos. :-)

Nevertheless, as I've paid for the Twonkyserver I'll have a look on the upcoming v7.0 by end of the year!

Locked