[Cin] Interlace driving me mad .....

Andrew Randrianasulu randrianasulu at gmail.com
Wed Nov 18 17:34:20 CET 2020


So, I grep'ed ffmpeg-4.3 sources and apparently thise falgs consumed by few encoders outside of mpeg2/4:

guest at slax:/dev/shm/cinelerra/cinelerra-5.1/cinelerra$ grep 'AV_CODEC_FLAG_INTERLACED_DCT' ../thirdparty/ffmpeg-4.3/libav
libavcodec/    libavdevice/   libavfilter/   libavformat/   libavresample/ libavutil/
guest at slax:/dev/shm/cinelerra/cinelerra-5.1/cinelerra$ grep 'AV_CODEC_FLAG_INTERLACED_DCT' ../thirdparty/ffmpeg-4.3/libavcodec/*.c
../thirdparty/ffmpeg-4.3/libavcodec/cuviddec.c:        avctx->flags |= AV_CODEC_FLAG_INTERLACED_DCT;
../thirdparty/ffmpeg-4.3/libavcodec/cuviddec.c:        avctx->flags &= ~AV_CODEC_FLAG_INTERLACED_DCT;
../thirdparty/ffmpeg-4.3/libavcodec/dnxhddata.c:            interlaced == !!(avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) &&
../thirdparty/ffmpeg-4.3/libavcodec/dnxhdenc.c:    if (avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) {
../thirdparty/ffmpeg-4.3/libavcodec/dvenc.c:    if (s->avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) {
../thirdparty/ffmpeg-4.3/libavcodec/libx264.c:    x4->params.b_interlaced   = avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT;
../thirdparty/ffmpeg-4.3/libavcodec/libxavs.c:    x4->params.b_interlaced   = avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT;
../thirdparty/ffmpeg-4.3/libavcodec/mpegvideo_enc.c:    if ((s->avctx->flags & (AV_CODEC_FLAG_INTERLACED_DCT | AV_CODEC_FLAG_INTERLACED_ME)) &&
../thirdparty/ffmpeg-4.3/libavcodec/mpegvideo_enc.c:    s->progressive_sequence = !(avctx->flags & (AV_CODEC_FLAG_INTERLACED_DCT |
../thirdparty/ffmpeg-4.3/libavcodec/mpegvideo_enc.c:        if (s->avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) {
../thirdparty/ffmpeg-4.3/libavcodec/mpegvideo_enc.c:        if (s->avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) {
../thirdparty/ffmpeg-4.3/libavcodec/nvenc.c:    if (ret < 1 && avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) {
../thirdparty/ffmpeg-4.3/libavcodec/nvenc.c:    if (avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) {
../thirdparty/ffmpeg-4.3/libavcodec/nvenc.c:        if (avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) {
../thirdparty/ffmpeg-4.3/libavcodec/pngenc.c:    s->is_progressive = !!(avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT);
../thirdparty/ffmpeg-4.3/libavcodec/proresenc_anatoliy.c:    ctx->is_interlaced = !!(avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT);
../thirdparty/ffmpeg-4.3/libavcodec/proresenc_kostya.c:    if (avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT)
../thirdparty/ffmpeg-4.3/libavcodec/proresenc_kostya.c:    int interlaced = !!(avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT);
../thirdparty/ffmpeg-4.3/libavcodec/qsvenc.c:    if (avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT) {
guest at slax:/dev/shm/cinelerra/cinelerra-5.1/cinelerra$ grep 'AV_CODEC_FLAG_INTERLACED_ME' ../thirdparty/ffmpeg-4.3/libavcodec/*.c
../thirdparty/ffmpeg-4.3/libavcodec/huffyuvenc.c:    s->interlaced = avctx->flags & AV_CODEC_FLAG_INTERLACED_ME ? 1 : 0;
../thirdparty/ffmpeg-4.3/libavcodec/motion_est.c:        if ((s->avctx->flags & AV_CODEC_FLAG_INTERLACED_ME)
../thirdparty/ffmpeg-4.3/libavcodec/motion_est.c:        if ((s->avctx->flags & AV_CODEC_FLAG_INTERLACED_ME)
../thirdparty/ffmpeg-4.3/libavcodec/motion_est.c:    if (s->avctx->flags & AV_CODEC_FLAG_INTERLACED_ME) {
../thirdparty/ffmpeg-4.3/libavcodec/mpegvideo.c:        (s->avctx->flags & AV_CODEC_FLAG_INTERLACED_ME)) {
../thirdparty/ffmpeg-4.3/libavcodec/mpegvideo_enc.c:    if ((s->avctx->flags & (AV_CODEC_FLAG_INTERLACED_DCT | AV_CODEC_FLAG_INTERLACED_ME)) &&
../thirdparty/ffmpeg-4.3/libavcodec/mpegvideo_enc.c:                                                AV_CODEC_FLAG_INTERLACED_ME) ||
../thirdparty/ffmpeg-4.3/libavcodec/mpegvideo_enc.c:            if (s->avctx->flags & AV_CODEC_FLAG_INTERLACED_ME) {
../thirdparty/ffmpeg-4.3/libavcodec/mpegvideo_enc.c:            if (s->avctx->flags & AV_CODEC_FLAG_INTERLACED_ME) {
../thirdparty/ffmpeg-4.3/libavcodec/mpegvideo_enc.c:            if (s->avctx->flags & AV_CODEC_FLAG_INTERLACED_ME) {


So, reworked this section again ... basically only excluding mjpeg codec case from setting those flags, instead of whilelisting mpeg2/4 only

Strangely ffv1/avi shows interlace (with my patch) if source was Top Field First and not showing it if source was Bottom Field First ..:/

dv file re-encoded as dv_ntsc.avi shows bff correctly, it seems.
mp4 container with h264 also gets it right now ....
mpeg2 works (but not sure if field order correct or now ..I'm confused by ffmpeg source :/)
mkv seems to work (but it was working before)

https://cloud.mail.ru/public/5AM1/275yC576u

How to test those 'tb/bb/tt/bt' cases? There must be some  artificial picture clearly showing if I did it wrong ..Not found it yet.




-------------- next part --------------
A non-text attachment was scrubbed...
Name: interlace_aspect_autodetect-12.patch
Type: text/x-diff
Size: 11443 bytes
Desc: not available
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20201118/db04b9fd/attachment-0001.bin>


More information about the Cin mailing list