Encoding frames error: Errno 22 Invalid Argument
Created by: flewellyn
I am attempting to create a "preview" of a video, using key frames. Here is the logic:
instream = invid.streams.video[0]
outvid = av.open('001_prev.mov')
outstream = outvid.add_stream(template=instream)
outstream.time_base = instream.time_base
instream.codec_context.skip_frame = 'NONKEY'
for frame in invid.decode(instream):
packet = outstream.encode(frame)
outvid.mux(packet)
outvid.close()
According to the docs, this should work, but the outtream.encode() call fails with Errno 22. I have no idea why. The frame itself is correct: when I use frame.to_image() and save a JPEG, it works just fine.