master-of-zen / Av1an

Cross-platform command-line AV1 / VP9 / HEVC / H264 encoding framework with per scene quality encoding
GNU General Public License v3.0
1.4k stars 147 forks source link

Encoding an interlaced video source fails - wrong frame count #848

Open oryjkov opened 1 month ago

oryjkov commented 1 month ago

Scene detection works fine, but the encoder fails with:

source pipe stderr:
        Trim: last frame beyond clip end

I dug a bit further into it and it seems that vspipe gets the -e parameter that it thinks is too big - it is passed "-e 5549", but it thinks the source file contains only half the frames, 2774.

I would think that the scene cutter and encoder should agree on the number of frames in the video, but do not in this particular case.

Command used:

target/release/av1an --verbose --log-level=debug --temp /tmp/123 -i 00004.MTS --workers 3 --chunk-order random -e aom -m lsmash -v ' --bit-depth=10 --cpu-used=4 --end-usage=q --cq-level=24 --tile-columns=0 --tile-rows=0 '

What worked:

  1. deinterlacing with ffmpeg before running av1an
  2. deinterlacing in the custom vapoursynth input file, like this:
    from vapoursynth import core
    import havsfunc as haf
    core.max_cache_size=1024
    clip = core.lsmas.LWLibavSource("00004.MTS", cachefile="/tmp/123/split/cache.lwi")
    clip = haf.QTGMC(clip, Preset='Slower', TFF=False)
    clip.set_output()