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.


Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 25th September 2013, 14:40   #1  |  Link
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
cretindesalpes's Avatar
Join Date: Feb 2009
Location: No support in PM
Posts: 621
trimx264opt A helper tool for x264 segmented encoding


Now we have the --stitchable option in x264, it becomes much easier to encode a video in multiple segments. There are multiple uses for this: mix different settings that cannot be set in --zones, redo only specific parts where global parameters or bitrate are unsatisfactory, make simultaneous encode to take a better advantage of a large number of cores, etc. Cutting (at GOP boundaries) and joining segments together can be achieved without much effort with ordinary muxing tools.

The problem is that x264 is not very handy when you need to encode just a part of a file. --seek and --frames could help but their behaviour with --qpfile, --zones and --tcfile-in is inconsistent. Plus, --seek often requires reading the source from the beginning. I looked for tools to overcome these problems but found nothing. Maybe I haven’t searched hard enough? Anyway, I finally came with my own (and modest) solution.

What is it?

trimx264opt is a Windows command line tool. It takes qpfile, zones and timecodes information and “shifts” a specified frame range to index 0. Therefore x264 can use directly these parameters to encode the source cut to this range, without the need of --seek or --frames. This can be done with Avisynth frameserving for example, with a Trim(beg, beg-end) after source loading.

As trimx264opt itself does only the basic things and is not very convenient, I added encode-part.bat which provides a template for encoding a segment (it requires to set some environment variables to locate trimx264opt, x264 and possibly avs2pipemod). Ideally we would need some kind of wrapper over x264 but at the moment this tool does the job and really helps.


r3: >>>> trimx264opt-r3.zip <<<<

Note: I’m pretty sure this kind of segmented encoding can break the VBV constraints on segment boundaries, and I’m not sure if there is a solution and how to make it work. If anybody knows something, shoot!
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r22 for Vapoursynth | trimx264opt segmented encoding

Last edited by cretindesalpes; 15th December 2013 at 14:14. Reason: r3
cretindesalpes is offline   Reply With Quote

qpfile, stitchable, timecodes, x264, zones

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 14:04.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.