Log in

View Full Version : Crazy problem piping to ffmpeg


ABurns
24th August 2021, 01:32
Hey guys, I've got a really crazy problem that makes absolutely no sense to me, and I need some insight from better minds than mine. I've made a little bash script that batch encodes DVD rips from the command line, and the exact same script on the same test file produces different results under under Windows 10 and Linux with wine. Works like a champ in Linux, produces A/V sync and/or frame rate problems in Windows. I need it to work reliably under Windows too.

The problem (best I can tell) is a difference in the way LSmashSource indexes the source file with respect to the 3:2 pulldown. It seems that the pulldown is always preserved under wine, meaning that I can always IVTC it to a proper 23.976 (which is what I want), but in Windows it's only preserved if it's a hard pulldown. Same versions of everything, same test file, same script. Different results. Makes no sense.

Here is the script I'm piping to ffmpeg that works in wine:

LWLibavVideoSource("temp.mkv")
Convertbits(8)
tfm(order=-1).tdecimate()
AssumeFPS("ntsc_film")

And here's the pipe to ffmpeg:

wine avs2pipemod64.exe -y4mp ./script.avs | ffmpeg -f yuv4mpegpipe -i - <yada, yada>

Works perfectly every time under wine, remove the wine command and run it under Windows and it produces a broken video stream. Any ideas what might be going on here?

Richard1485
24th August 2021, 02:31
Are you using the latest version (http://avisynth.nl/index.php/LSMASHSource)? There are some notes in the change-log that might be relevant:
LWLibavVideoSource/LWLibavSource: Respect mpeg2 soft pulldown flag in more cases. (AkarinVS)
LWLibavVideoSource/LWLibavSource: If repeat=1/true and the input video requested repeat, but the source filter is somehow unable to obey it, fail explicitly instead of silently returning a VFR clip with a constant (but wrong) fps. To revert to the previous behavior, set repeat=2. (AkarinVS)

Perhaps this is what you are coming across, and it's causing the frame-rate/sync issues. (The source filter might be behaving differently under Wine for some reason -- compatibility mode, etc.) You might try setting repeat/dominance (http://avisynth.nl/index.php/LSMASHSource/LWLibavVideoSource) explicitly.