blocksize function, is it possible to limit the video output size #39
-
|
have 2 questions :
code result expected result best regards |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
sets the number of frames to read at once (only used by a reader or filter streams). For example, with ffmpegio.open(input, 'rv', blocksize=100) as fin
for frames in fin:
assert frames.shape[0]==100should read all the frames. The last block likely does not contain 100 frames, and it would results in the assertion error.
This is a quintessential FFmpeg question. The short answer is you cannot in a one-pass encoding. You can use a two-pass encoding to specify the size. See https://trac.ffmpeg.org/wiki/Encode/H.264#twopass However, But I don't think this is what you're interested in. You want to know if you can stop the reader stream when it has written so many frames. As far as I know, you cannot do it by the file size, but you can specify the duration in seconds by There is a way to terminate it by the number of bytes read using the progress callback. But I'm spotting bugs which freezes the execution (interlocked thread). If you're interested, I'll remember to come back to this thread for a solution once the bugs are sorted out. |
Beta Was this translation helpful? Give feedback.
-
|
nice thx |
Beta Was this translation helpful? Give feedback.
sets the number of frames to read at once (only used by a reader or filter streams). For example,
should read all the frames. The last block likely does not contain 100 frames, and it would results in the assertion error.
This is a quintessential FFmpeg question. The short answer is you cannot in a one-pass encoding. You can use a two-pass encoding to specify the size. See https://trac.ffmpeg.org/wiki/Encode/H.264#twopass
However,
ffmpegiocurrently provide a simple interface fort…