Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mencoder xvid feature request, or not work as expected report. #20

Open
bikkoism opened this issue Dec 18, 2022 · 9 comments
Open

Mencoder xvid feature request, or not work as expected report. #20

bikkoism opened this issue Dec 18, 2022 · 9 comments

Comments

@bikkoism
Copy link

I have request/report about sth 'zones' option in xvid encoder. Currently this option is incomplete, or not work as expected. Here is the document of this option for xvid_encraw 1.3.5.

-zones start,mode,value[,options][/start,mode,value[,options]]...

Parameters of a zone use the comma (,) as a delimiter. Multiple zones are
separated by a slash (/). The end of each zone is defined by either the start
of the following zone or the last frame of the input file.

start : start frame of the zone
mode : weight zone = w, quantizer zone = q
value : depending on mode either the zone's weight or quantizer
options : enable certain encoder features for the zone. Each feature is
represented by a single letter. An integer number stands for
b-frame sensitivity. To enable multiple features at the same time
combine the appropriate symbols without any delimiting characters.
K = begin with keyframe
O = enable chroma optimizer
G = greyscale encoding
C = cartoon mode
integer = b-frame sensitivity

Example:
to create a first zone starting at frame 0 with weight 1.0, all options
enabled and b-frame sensitivity -5, and a second zone starting at frame 1000
with constant quant 4 and no options enabled you would use the -zones option
like this:

-zones 0,w,1.0,-5KOGC/1000,q,4

zones options is work as expected on xvid_encraw. Mencoder uses same xvidcore 1.3.5 so this option should be available as it is I believe. but currently, Seems 'zones' on Mencoder xvid doesn't really parse [,options], '-5KOGC' part in Example section is ignored. As a result can not use full feature of it.

Most importantly, This is the only option available to forcing specific frame to keyframe. Without this option There are no way to align keyframes, such as each frame of chapter start points.

As far as I know, xvid is more than 20 years old codec. Funnily, Still there are no encoders around do it properly. All encoders have serious bug or misfeatured. Even xvid_encraw has serious bug/imperfect feature which makes you can't encode anything at all. I really hope if Mencoder xvid could be fully featured.

@bikkoism
Copy link
Author

I figured out alternative solution to force keyframes already exist in MEncoder. Its "fixpts" filter and "-force-key-frames" option combination. Seems It is working for xvid encodes.

Still, This feature request is stand. I believe that It would be a bit absurd if this option remains incomplete.

@sherpya
Copy link
Owner

sherpya commented Dec 20, 2022

I suspect I need to use posix thread model instead of win32 thread model of mingw

@bikkoism
Copy link
Author

I'm confused if your reply is about #21 multithreads issue, not this one.

@sherpya
Copy link
Owner

sherpya commented Dec 20, 2022

I'm confused if your reply is about #21 multithreads issue, not this one.

you are right, I've replied the wrong issue, but it may be also related

@bikkoism
Copy link
Author

bikkoism commented Dec 20, 2022

Not sure. I looked into sourcecode of official xvidcore and MEncoder xvid both. I'm not a coder and my knowledge is very limited, But as far as I understand Mencoder xvid doesn't parse the zone option perfectly at first place. And I found variables zones[].type, zones[].greyscale, zones[].chroma_opt… etcs from official xvidcore seems related with this option. Meanwhile MEncoder xvid zones structure doesn't have them. So I suspect if It is not related with multithreads issue.

@sherpya
Copy link
Owner

sherpya commented Dec 20, 2022

I'll check the sources

@sherpya
Copy link
Owner

sherpya commented Dec 20, 2022

mencoder parses zones options differently, by looking a the manual:
also in libmpcodecs/ve_xvid4.c

       zones=<zone0>[/<zone1>[/...]] (CBR or two pass mode)
              User specified quality for specific  parts  (ending,  credits,  ...).   Each  zone  is
              <start-frame>,<mode>,<value> where <mode> may be
                 q    Constant  quantizer  override, where value=<2.0-31.0> represents the quantizer
                      value.
                 w    Ratecontrol weight override, where value=<0.01-2.00>  represents  the  quality
                      correction in %.

              EXAMPLE:
                 zones=90000,q,20
                      Encodes all frames starting with frame 90000 at constant quantizer 20.
                 zones=0,w,0.1/10001,w,1.0/90000,q,20
                      Encode  frames  0-10000  at  10% bitrate, encode frames 90000 up to the end at
                      constant quantizer 20.  Note that the second zone is  needed  to  delimit  the
                      first  zone, as without it everything up until frame 89999 would be encoded at
                      10% bitrate.

@bikkoism
Copy link
Author

Is it not possible to implement it then?

@sherpya
Copy link
Owner

sherpya commented Dec 20, 2022

Is it not possible to implement it then?

maybe but it would break other format, or I would need to count commas in the hope there are no overlaps in formats

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants