Vapoursynth officially added audio support in September, and had it in testing before then. Since it now supports audio, I'm looking to convert over some old Avisynth projects to Vapoursynth. Part of this is driven by my familiarity with Python, and part of it is that it's far easier to set up Vapoursynth with QTGMC in my linux distro of choice.
Anyway, my problem is that when I run the script and pipe the result over to FFMPEG, FFMPEG only gets the video stream and not the audio stream. From a script standpoint, it looks like I should be doing everything right, but there is so little documentation on working with audio that I can't be sure. I'm leaning toward an issue with my vspipe command, but I'm not sure what needs to be done to say "There is audio in this stream"
Here is the script followed by the vspipe/ffmpeg command:
import vapoursynth as vs
import havsfunc as haf
import math
core = vs.core
# Assume NTSC standard framerate and 48kHz as default
def framesToSamples(frameNum, framerate=29.97, samplerate=48000):
return math.floor((samplerate/framerate)*frameNum)
video = core.ffms2.Source(r'Home Movies 1 - 1989.avi', format=vs.YUV422P8)
audio = core.bas.Source(r'Home Movies 1 - 1989.avi', track=1)
video = video[71:217640]
audio = audio[framesToSamples(71):framesToSamples(217640)]
video = core.cnr2.Cnr2(video,"ooo",8,16,191,100,255,32,255,False) #VHS
video = haf.QTGMC(video, Preset="Very Slow", EZDenoise=2.0, TrueMotion=True, ChromaMotion=True, TFF=False)
video = core.std.Crop(video,4,0,4,6)
video = core.resize.Lanczos(video, 352, 240, format=vs.YUV422P10)
video.set_output(0)
audio.set_output(1)
And the command to convert:
vspipe -c y4m "Home Movies 1 - 1989.vpy" - | ffmpeg -i pipe: -c:v libx265 -preset fast -crf 24 -c:a libopus -b:a 96k -ac 1 Test.mkv