This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Profile with crf=20

Tags: None
(comma "," separated)
pinguin_drupal
Registered Member
Posts
49
Karma
0

Profile with crf=20

Mon Jan 16, 2012 6:05 pm
How can I create a working profile, which uses crf=20 as quality.

Below is the sourcefile, there should be no change in resolution, preferred container would be mkv, but others would be ok too.

Sourcefile:
mediainfo test.mkv
General
Unique ID : 30065369223496152199292532958166510834 (0x169E61261A6C7E41CF48EDD68657ECF2)
Complete name : test.mkv
Format : Matroska
Format version : Version 2
File size : 28.3 MiB
Duration : 20s 760ms
Overall bit rate mode : Variable
Overall bit rate : 11.4 Mbps
Writing application : HandBrake 4394svn
Writing library : libmkv 0.6.5

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.0
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 20s 760ms
Width : 736 pixels
Height : 416 pixels
Display aspect ratio : 16:9
Frame rate mode : Variable
Frame rate : 25.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Writing library : x264 core 119
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / 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 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=crf / mbtree=1 / crf=12.0 / qcomp=0.60 / qpmin=3 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Language : English
Color primaries : BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M
Transfer characteristics : BT.709-5, BT.1361
Matrix coefficients : BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M

Audio
ID : 2
Format : FLAC
Format/Info : Free Lossless Audio Codec
Codec ID : A_FLAC
Duration : 20s 760ms
Bit rate mode : Variable
Channel(s) : 2 channels
Sampling rate : 44.1 KHz
Bit depth : 16 bits
GMaq
Registered Member
Posts
47
Karma
0

Re: Profile with crf=20

Mon Jan 16, 2012 6:57 pm
Hi

Here is an H.264 m4v preset I use for Apple iPod/General Media Player compatibility which uses CRF if you want to use it as a guide:

threads=4 s=720x480 aspect=%dar progressive=1 acodec=aac ab=128k vcodec=libx264 crf=21 flags=+loop cmp=+chroma partitions=+parti8x8+parti4x4+partp8x8+partb8x8 me_method=umh subq=7 me_range=16 g=250 keyint_min=25 sc_threshold=40 directpred=1 trellis=1 coder=0 bf=0 refs=3 flags2=-wpred-dct8x8 level=30 bufsize=256k wpredp=0
pinguin_drupal
Registered Member
Posts
49
Karma
0

Re: Profile with crf=20

Tue Jan 17, 2012 12:31 am
Thanks, I "played" in the meantime myself. Unfortunately I don't understand the most options. What do you think about these tests?

First I tried with ffmpeg:

ffmpeg -i source.mkv -vcodec libx264 -vpre medium -crf 20 -acodec libmp3lame -ab 256k -ar 44100 -ac 2 -threads 1 out.mkv

Then I tried this with kdenlive:

acodec=libmp3lame ab=256k ar=44100 ac=2 vcodec=libx264 vpre=medium crf=20 threads=1

Damned short ;-)
Am I missing important options?

What I would like to know, if vpre=medium is at the right position.

This is the result ananlyzed by mediainfo:


General
Unique ID : 85509902488245924953922952976445572412 (0x40549BB150D8EDF7BD3103E61331853C)
Complete name : Unbenannt.mkv
Format : Matroska
Format version : Version 2
File size : 1.51 MiB
Duration : 5s 303ms
Overall bit rate : 2 396 Kbps
Writing application : Lavf53.2.0
Writing library : Lavf53.2.0

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.1
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 5s 320ms
Bit rate : 2 092 Kbps
Width : 1 024 pixels
Height : 576 pixels
Display aspect ratio : 16:9
Frame rate mode : Variable
Frame rate : 25.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.142
Stream size : 1.33 MiB (88%)
Writing library : x264 core 116 r2042 178455c
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / 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 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=20,0 / qcomp=0,50 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1,25 / aq=1:1,00
Language : English

Audio
ID : 2
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 3
Mode : Joint stereo
Mode extension : MS Stereo
Codec ID : A_MPEG/L3
Codec ID/Hint : MP3
Duration : 5s 302ms
Bit rate mode : Constant
Bit rate : 256 Kbps
Channel(s) : 2 channels
Sampling rate : 44.1 KHz
Compression mode : Lossy
Stream size : 166 KiB (11%)
Language : English

BTW http://dev.gentoo.org/~beandog/x264_preset_reference.html shows a nice overview of presets and http://forum.videohelp.com/threads/277807-Useful-FFmpeg-Syntax-Examples helped me to build the rendering options
GMaq
Registered Member
Posts
47
Karma
0

Re: Profile with crf=20

Tue Jan 17, 2012 4:01 am
Hi,

Actually you're on the right track because the presets (ie -vpre medium) are calling the needed H.264 options by default so you don't have to worry about getting them all one by one. I have to admit to being a bit out of the loop with exactly what ffmpeg options can be called with melt and what syntax is supported. For instance newer versions of ffmpeg now use '-preset medium' rather than '-vpre medium' and I'm not certain which syntax is supported by melt. Really let your eyes be the judge, if you like the output quality you're getting and the video is compliant with whatever end purpose you intend then you're all set. CRF at settings of 20 or lower makes a huge quality difference on it's own, certainly more noticeable that some of the other H.264 optional settings.
pinguin_drupal
Registered Member
Posts
49
Karma
0

Re: Profile with crf=20

Tue Jan 17, 2012 11:21 am
IMHO it depends very much on the source-quality. I use crf=20, although I think it is too much for bad VHS sources. Garbage remains garbage.

Any suggestions to optimize VHS and SVHS sources?
GMaq
Registered Member
Posts
47
Karma
0

Re: Profile with crf=20

Tue Jan 17, 2012 6:17 pm
Hi,

I have a suggestion but you may not like it...

I spent years with numerous filters in Virtualdub on Windows messing with VHS and TV captures etc. What I learned is exactly what you've already said 'garbage is garbage' truthfully you can't put back what has already been lost. Nowadays I simply do basic color corrections and brightness and contrast adjustments on TV/VHS footage. I learned that denoising removes detail which is already severely lacking in VHS sources and sharpening amplifies noise which is already present at problematic levels so you are really damned either way...

Early on in my video addiction I didn't want to listen to the folks who told me not to waste my time with obsessive filtering but in the long run they were right... not that I'm anyone particularly worth listening to but I'm just passing along what I learned FWIW...
pinguin_drupal
Registered Member
Posts
49
Karma
0

Re: Profile with crf=20

Wed Jan 18, 2012 2:20 am
I don't like it, but I have to accept it ;-)

I try to find out some basic improvements with old VHS-tapes, especially color correction. Maybe a little bit sharpening and denoising can be fine too. The good thing with these old camcorder tapes is, that quality is not so important, what counts is the memory.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot]