Av1an
Av1an copied to clipboard
Av1an output skips sections, has still frame at the end of the Video and desynced audio
Hi!
I've deinterlaced some partially interlaced DVD footage using
ffmpeg -i video.mkv -map_metadata 0 -map 0 -c:v ffv1 -vf "fieldmatch=order=tff:combmatch=full, bwdif=deint=interlaced" video_deint.mkv
To only deinterlace the parts of the video that actually need it. The resulting video File is in this way properly deinterlaced and plays fine.
I then try to use av1an to convert it to av1 (using rav1e) and x265 to compare the results:
av1an --temp /media/user/ramdisk/av1antmp -i video_deint.mkv -w 6 --chunk-method hybrid -e rav1e --target-quality 93 --vmaf -o video_av1_deint.mkv
and
av1an --temp /media/user/ramdisk/av1antmp -i video_deint.mkv -w 6 --chunk-method hybrid -e x265 -c mkvmerge --target-quality 93 --vmaf -o video_deint_265.mkv
Av1an completes without warning nor error in both cases.
The resulting video file though has a lot of missing sections and the sound desyncs because of it. This is visualized in the attached vmaf svg graphs:
This also happens to other video files I've treated this way.
I'd be happy to send you a link to the video.mkv and video_deint.mkv in question via mail on request (it's just the studios intros), but I'm weary of sharing it here publicly for copyright reasons.
I'm using a 3 day old build of rav1e and ffmpeg, av1an is current from cargo, all else is current ubuntu 22.04
Can you provide 1 minute (for test) example of source? Have you tried to deinterlace into AVC(x264)?
I've sent you an email to your commit email address with a link to two example source files:
1min.mkv was extracted using
ffmpeg -fflags +genpts -ss 00:06:30 -to 00:07:30 -i A1_t01.mkv -c copy -map 0 -map_metadata 0 1min.mkv
and A1_t00.mkv is directly remuxed dvd video. Both exhibit the issue at hand. The presence of -fflags +genpts
makes no difference in behavior, but I've left it in here.
1min.mkv causes av1an to crash when given as input directly:
av1an --temp /media/user/ramdisk/av1antmp -i 1min.mkv -w 6 --chunk-method hybrid -e x265 -c mkvmerge --target-quality 93 --vmaf -o 1min_265.mkv
but that's probably another issue. I've included A1_00.mkv because it doesn't doesn't cause this crash, yet many other of my to be converted videos do with the same error.
I've tried deinterlacing into x264:
ffmpeg -i 1min.mkv -map_metadata 0 -map 0 -c:v libx264 -crf 0 -preset fast -vf "fieldmatch=order=tff:combmatch=full, bwdif=deint=interlaced" 1min_264_deint.mkv
and the same behavior is present (still frame at the end, lots of skipped frames)
I've also tried reencoding the deinterlaced video:
ffmpeg -i A1_t00_deint.mkv -c:v ffv1 -map 0 -map_metadata 0 A1_t00_deint_reenc.mkv
This also made no difference.
I only have one question: have you tried using different chunking methods?
ffmpeg hybrid is known to cause such issues, while ffms2 and lsmash aren't.
No I have not. I've just tested select
and (apparently unsurprisingly) the output looks the same. I'll try and setup lsmash and ffms2 and report back.
I've managed to set them up now.
select
and hybrid
result in the same video:
lsmash
makes the problem even worse, doesn't even get the first few frames right and also has a still frame at the end:
ffms2
desyncs too, but doesn't seem to result in still frames:
just for completeness I've also tried
segment
, but that made av1an crash.