PDA

View Full Version : how to change transcoding quality



razor
06-06-2010, 04:24 AM
Hi!

I have samsung TV - C650. It works well with Mezzmo, even transcoding with all my films works.
But, transcoded films are awful, quality is more than poor (fullhd mp4 or fullhd mkv)
I have core i5 3.5GHz CPU, ffmpeg.exe uses one core and my LAN is used not to the limits.

How to change transcoding quality ? Transcoded films have changed resolution (its not fullhd) and quality is few times worse than SD signal from TV cable.

transcoded from Mezzmo
http://i45.tinypic.com/15yf77m.jpg

original
http://i45.tinypic.com/2hydv21.jpg


I don't expect that transcoded film will be the same quality as original, but it could be much better, especially if there is plenty of CPU power and plenty of LAN bandwidth (100Mb/s)


I do some more investigations, my Samsung LE46C650 doesn't want to accept mp4 file with 1920x1080 resolution (it says 'format not supported').
It accept film from Mezzmo only when I set Maximum movie size to 1280x720 (best quality) - above screenshot (with awful quality) is taken with this settings (1280x720, best quality)

Paul
06-07-2010, 09:06 AM
Hi,

Can you please generate a diagnostic log (see this thread: http://forum.conceiva.com/showthread.php?t=419) of the above transcoding and send it to support@conceiva.com? I'll then be able to see the input and output of the transcoding and see why it's of such bad quality. Generally, Mezzmo aims at achieve the best possible quality, as close to the original as possible.

Please delete the transcoded file (let me know if you need help on finding them), so that it's re-transcoded again before you try to play and log it (otherwise it'll be picked up from the cache and I won't see the actual transcoding take place in the log).

razor
06-08-2010, 01:03 AM
I sent you my logs.

From logs I see that ffmpeg almost all frames compresses at q=50 :/ is that a problem ?

how to change quantization parameters? I see qmin and qmax in SamsungLA.prf file (in ffmpegadditional element), but after changing parameters (and restarting mezzmo), nothing happens, ffmpeg is run with the same old parameters (qmin=10, qmax=51)

"C:\Program Files (x86)\Mezzmo\ffmpeg.exe" -i "D:\films\_KITEF~1\ADDIKT~1.MP4" -y -vcodec libx264 -sameq -copyts -s 1280x720 -acodec ac3 -ac 2 -ab 448000 -ar 48000 -sn -f matroska -coder 1 -flags +loop -cmp +chroma -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -bf 3 -refs 2 -directpred 1 -trellis 1 -flags2 +bpyramid+mixed_refs+wpred+dct8x8+fastpskip -wpredp 2 "x:\TranscodingFiles\DAE6F66B-745D-46b5-930A-A570F45B8E3E\Video\4-mkv-libx264-ac3.mzt"

In the logs we can see, that ffmpeg uses default bitrate=200kb/s

[libx264 @ 01607970]264 - core 98 r0+1629 2e81ce1 - H.264/MPEG-4 AVC codec - Copyleft 2003-2010 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0 me=hex subme=6 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=200 ratetol=20.0 qcomp=0.60 qpmin=10 qpmax=51 qpstep=4 ip_ratio=1.41 aq=1:1.00


If I run ffmpeg with additional parameter -b 900k, transcoded material looks better. How can I change this options in Mezzmo ?
(also, you could compile ffmpeg with threading enabled)


For now, I created simple program 'ffmpeg.exe' (I took original ffmpeg.exe from PS3 Media Server, because it supports multithreading and renamed it to ffmpeg2.exe). My program adds two parameters: -b 2000k -threads 4 and calls ffmpeg2.exe and everything works :)

Paul
06-08-2010, 08:48 AM
Thank you for the logs and the investigation you've done.

At the moment we compile FFmpeg with w32threads support, not pthreads and I think that libx264 cannot use w32threads, so we plan to change that for the next update and then multithreading will be possible in libx264 as well. Currently multithreading only works in MPEG2.

To specify a transcoding bitrate you can add

<bitrate>2000000</bitrate> to the h264 video container and that will then add "-b 2000000" to FFmpeg's command line when transcoding. Number of threads needs to be passed in via the ffmpegadditional just as "-threads 4".

razor
06-08-2010, 03:50 PM
Is transcoding to mpeg2 faster? default transcoding is to mpeg4? (above example)
On my processor, transcoding that film gives ~20-25fps, so sometimes its too slow to make 'realtime transcoding'. Is mpeg2 compression better for 'realtime transcoding' ?
how to change transcoding to mpeg2 (with MT) ?

Paul
06-08-2010, 03:57 PM
Generally Mezzmo will try to pick the closest match out of available transcoding combinations (marked by encode="1" in the device profile), so as to save time and preserve quality. If it finds a matching video stream in a non-supported container (for example), it'll try to remux the file by only changing the container and copying the video stream.

Can you please post FFmpeg information about that file, so that I could check what it can be transcoded to?

MPEG2 may be faster for encoding than MPEG4, but then it also depends on the input format, the amount of transcoding FFmpeg needs to do (e.g., resize, change bitrate, etc...). If we could just copy the video stream, it will be faster than re-coding it of course.

razor
06-08-2010, 09:18 PM
this is file info (taken from logs that I sent you)

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\films\_KITEF~1\ADDIKT~1.MP4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
Duration: 00:20:25.32, start: 0.000000, bitrate: 4160 kb/s
Stream #0.0(eng): Video: h264, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 3999 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc
Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16, 157 kb/s
I guess that Samsung doesn't play this material, not because of size (1920x1080), but maybe because too high bitrate or unusual GOP shape ?

razor
06-09-2010, 01:32 AM
Ok, now everything works, there was my mistake too, I've edited file in Program Files\Mezzmo folder, but proper files are in c:\ProgramData\Conceiva\Mezzmo\DeviceProfiles\


and about transcoding my film, I've upgraded firmware (from end of april, to some last from end of may), now it plays my mp4 films without transcoding and from USB :)

Paul
06-09-2010, 08:45 AM
Great! Thanks for letting me know.

Comancheace
06-29-2010, 08:32 AM
Can you please explain how did you did that program? I need ffmpeg to transcode my incompatibles files to m2ts, or normal output format in max size 720x406 and playback the compatibles files at 1920x1080.

Thank you

Comancheace
06-29-2010, 06:19 PM
In what file do you add <bitrate>200000</bitrate>? How about output video size? Where can you specify?

Thank you

Paul
06-30-2010, 08:23 AM
In what file do you add <bitrate>200000</bitrate>? How about output video size? Where can you specify?

Thank you
You add it to the device profile you're trying to modify, e.g. NetgearDigitalEntertainerLive.prf - but that bitrate is too low, why do you want to add it in?