Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
11th March 2011, 10:40 | #1 | Link | |
Registered User
Join Date: Oct 2001
Posts: 52
|
How to encode screencasts in x264 (with vfr?)
Hi,
I'm very new to this H.264 thing. I have a bunch of screencast tutorial videos (captured desktop screen; slides; command-line editing) which I would like to encode in H.264/MP4. The videos are encoded with TSCC (TechSmith Screen Capture) codec, 15 fps avi. Right now in AviSynth script I have 2 lines: Code:
DirectShowSource("file.avi", audio=false) ConvertToYV12() Quote:
Today I found out that the videos can also be encoded in variable frame rate (vfr) mode. So I am thinking that vfr could be very beneficial to screen captured videos. I tried searching doom9 forum, but found nothing substantial. So, can x264 encode in vfr mode? What command-line options should be added? Or the AviSynth script should be changed? Thank you |
|
11th March 2011, 11:57 | #3 | Link | |
Registered User
Join Date: Apr 2008
Posts: 1,181
|
Why did you write an avs that actually does nothing but messes up with timestamps?
When you are dealing with vfr source, forget avisynth script. Encode your avi directly Quote:
If your x264.exe is unable to decode the avi using built-in decoders, try this. Last edited by roozhou; 11th March 2011 at 11:59. |
|
11th March 2011, 18:00 | #7 | Link | |
Registered User
Join Date: Apr 2008
Posts: 1,181
|
Quote:
And another question about vfr: since the official x264 build is still using a linear scenecut threshold based on frame count, adding skipped frames will affect frame type decisions. So will it be good or bad to change it to pts-based? |
|
13th March 2011, 10:49 | #8 | Link |
Registered User
Join Date: Oct 2001
Posts: 52
|
I managed to run the source video through DeDup AviSynth filter (it dropped about 90% of frames) and produced time code file, which is, I think is mkv compatible (# timecode format v2).
How do I merge timecodes to the mp4 file? Should it be done at encoder (x264) level or with muxer, e.g. mp4box? |
13th March 2011, 12:34 | #9 | Link | |
Registered User
Join Date: Apr 2008
Posts: 1,181
|
Quote:
|
|
14th March 2011, 01:53 | #11 | Link |
typo lover
Join Date: May 2009
Posts: 595
|
x264cli can do it with --demuxer ffms/lavf.
__________________
my repositories |
17th March 2011, 01:52 | #12 | Link |
Registered User
Join Date: Oct 2001
Posts: 52
|
Is there a way to keep the rgb or at least yuv 422 colorspace in x264 output file? If i'm feeding x264 with rgb colorspace or add a switch "--vf resize:csp=rgb", the resulting file always has yuv 420.
I'm using x264 windows binary r1913. Last edited by Evaldas; 17th March 2011 at 01:55. |
2nd November 2013, 20:18 | #14 | Link |
Registered User
Join Date: Nov 2005
Location: Russia
Posts: 62
|
This is how i encoded some screencapture
How i've done Hi444PP 10bit VFR mkv
Source: YV24 or RGB screencapture done with virtualdub. Source framerate was not completely constant, thus to sync with audio: Code:
audiodubex(FFVideoSource(source=source, fpsnum=30000, fpsden=1000, threads=1), FFAudioSource(source=source)) Code:
RemapFrames(filename="capture_RemapFrames.txt") DeDup using idea was more intersting but probably had same problem with YV24 (didn't test actually). I have found ExactDeDup, with YV24 support and DeDup ability to remove big blocks of duplicated frames. I used it in two passes. First one to linearly "walk" through whole source: Code:
#ExactDeDup 1pass ExactDedup(firstpass = true, maxdupcount=80000, keeplastframe=false, dupinfo="dup.txt", times="ExactDedup_times.txt") times - timecodes file for muxing with mkvmerge from mkvtoolnix to get VFR mkv file. This first pass can be done either by "Run video analysis pass" of VirtualDub, or from commandline with avs2pipemod: Code:
avs2pipemod.exe -benchmark capture.avs Code:
#ExactDeDup 1pass #ExactDedup(firstpass = true, maxdupcount=80000, keeplastframe=false, dupinfo="dup.txt", times="ExactDedup_times.txt") #ExactDeDup 2pass ExactDedup(firstpass=false, dupinfo="dup.txt") While encoding in x264 i have found that using --tcfile-in option is breaking many resulting frames (tested on 2145 JEEB build, and 2358 and 2377 komisar builds). Solution is to mux timecodes in mkvmerge only. This is how i sent video to x264: Code:
"%avs2pipemod_path%" -rawvideo "%source1%" | "%x264-10bit_64_path%" --demuxer raw --input-depth 8 --input-res 1280x960 --input-csp i444 --profile high444 --level 4.1 --preset veryslow --scenecut 80 --sar 1:1 --colormatrix bt709 --transfer bt709 --colorprim bt709 --crf 19 --min-keyint 1 --vbv-maxrate 50000 --vbv-bufsize 62500 --output-csp "i444" --frames 16080 --log-file "%source_path%%source_filename1%-log_type2.txt" --output "%coded_video1%" - 2> "%source_path%%source_filename1%-log.txt" Bottom line Pros. One of the good features of that VFR is its small encoding time. I don't know yet about size compared to CFR encode (it is encoding right now. Now to the cons. Bad support by players (or splitters+decoders - no matter from user side). MPC-HC 1.6.8 (without internal LAVFilters) defaults have some sound pauses while seeking and sometimes desync after seeking. LAVSplitter (internal for newest MPC-HC or external) read wrong size and even not start playing. AVSplitter (with potplayer) read wrong size but is OK with sound while seeking.
__________________
Avisynth syntax highlighting for AkelPad Last edited by Lenchik; 13th November 2013 at 19:14. |
Tags |
screencapture, screencast, vfr, x264 |
|
|