Opened 14 years ago
Last modified 12 years ago
#1786 new defect
unable to set xvidenc flag XVID_VOP_TOPFIELDFIRST
Reported by: | Owned by: | reimar | |
---|---|---|---|
Priority: | normal | Component: | ve |
Version: | 1.0rc4 | Severity: | normal |
Keywords: | Cc: | jarekczek@…, Dr.O.Muth@…, jaycee@… | |
Blocked By: | Blocking: | ||
Reproduced by developer: | no | Analyzed by developer: | no |
Description
If we're using "interlacing" xvidenc flag, we should be able to specify the field order. Default in xvid is "bottom field first". We can change it with the XVID_VOP_TOPFIELDFIRST flag.
If I don't specify the TFF flag, I'm not able to play the video in my stationary dvd player (CH DVD-462). Movement is jumpy.
If I change the code in ve_xvid4.c like this:
if(xvidenc_interlaced && (selected_profile->flags & PROFILE_INTERLACE)) {
frame->vol_flags |= XVID_VOL_INTERLACING;
frame->vop_flags |= XVID_VOP_TOPFIELDFIRST; this is my new line
}
then the video is excellent.
Please someone make this change in a suitable manner, through the proper command line switch and with the manual update. Xvid clears the tff flag if "interlacing" is not on. Not sure if we should report an error when the users specifies non-int and tff together.
By the way, if I understood the xvid code correctly: xvid ignores this flag but passes it to the bitstream to allow the player to know which field order is used.
Attachments (2)
Change History (11)
comment:1 by , 14 years ago
Cc: | added |
---|
by , 14 years ago
Attachment: | xvid_tff.diff added |
---|
comment:2 by , 14 years ago
Try this patch, it uses the same method as libavcodec (except not allowing to override via codec options).
Note I do not have xvid installed so it might not even compile as-is, but I guess you can do any necessary fixes on your own.
And you might consider just using libavcodec...
comment:3 by , 14 years ago
Reimar, so the suitable option would be -field-dominance, right? But we would be making here a big change, because xvid's default is BFF and mplayers default is TFF (it is said so in the manual). So after applying this patch all users making interlaced encoding on xvid may fall into a big surprise.
Anyway I'll test this solution.
comment:4 by , 14 years ago
It doesn't work in this way. Your suggestion was to rely on flags:
MP_IMGFIELD_ORDERED
MP_IMGFIELD_INTERLACED
MP_IMGFIELD_TOP_FIRST
I see no way to set the first 2 of them. Looks like it's decoder dependent. Wouldn't it be better to make it independent of the decoder?
Somehow MP_IMGFIELD_TOP_FIRST gets lost when the 2 others or not set: when we get into set_frame_struct its value is always zero.
Could you advice me how to read directly -field-dominance parameter value in the dispatch_settings of xvid? Of course if it makes sense for you to do it this way.
comment:6 by , 14 years ago
Well, maybe not.
That's how it goes.
- Decoder can set field interlacing flags (MP_IMGFIELD_ORDERED, MP_IMGFIELD_INTERLACED, MP_IMGFIELD_TOP_FIRST). A few do this. vd_raw for example does not.
- For the decoders that don't supply the interlacing flags, one can set the flag MP_IMGFIELD_TOP_FIRST through the field-dominance switch. There is no switch to set the 2 other flags, so the field-dominance switch is made almost useless
- Ffmpeg encoder has the switch "top" which has greater priority than the decoder flags. Xvidenc has no such switch.
So what to do:
- create a flag "top" for xvid
- create a decoder switch to fill the interlaced flags of the input stream - many encoders could benefit from this
- make xvid rely on field interlacing flags (but the priority of A. is greater, as in lavc)
- make it possible that mplayer shows this flags when playing back (hard to do because these flags are read only after "Starting playback"). Few tools show it and some video forum people even deny the existance of them.
I can do these things, except the fine solution for D. Just tell me and maybe give the flags' names.
If this bug entry became my own blog without being read nor answered from anyone, then I'll post only the A. fix.
comment:7 by , 14 years ago
Cc: | added |
---|
For what it's worth, I would very much appreciate solution A.
Of course it would be nice to have the decoder automagically pass on its flag to the decoder, but I guess that's more work, and most users probably have just one type of videos they encode: either bff (then they don't need the switch anyway) or tff, in which case they could simply define the new "top" flag in their standard profile.
comment:8 by , 14 years ago
comment:9 by , 12 years ago
Cc: | added |
---|
Recently I stumbled over the same issue with my standalone dvd player and it took me ages to figure out what was wrong. Applying the patch Jarek posted on the mailing-list fixed the jittering completely for me. Hence, I strongly recommend applying some variation of this patch and changing the default behaviour of xvid encoding to copy the field dominance of the interlaced source material.
Set TFF flag for xvid the same way as for lavc