Page MenuHome

Remove VSE Strip Proxy Resolution limitation
ClosedPublic

Authored by Eitan Traurig (EitanSomething) on Jan 1 2020, 8:43 PM.

Details

Summary

Removes hack that sets the resolution to be a multiple of 8 because the limitation of mjpeg in ffmpeg no longer exists.

Diff Detail

Repository
rB Blender
Branch
DimesionsLimitation (branched from master)
Build Status
Buildable 6145
Build 6145: arc lint + arc unit

Event Timeline

I have been looking at ffmpeg docs, that prescribe this. Blame says nothing, patch works, so I happily hit accept.
@Sergey Sharybin (sergey) Do you know about any problems this could cause?

This revision is now accepted and ready to land.Jan 5 2020, 10:46 PM

This is codec-specific, and not so much a requirement of FFmpeg itself.

Which codec is used here for the proxy output? It may have other requirements for the frame dimensions.

I can confirm jpeg needs to be a multiple of 8

This is codec specific, but I haven't found any requirements mentioned in ffmpeg docs mentioning this(or anything anywhere).

@Eitan Traurig (EitanSomething) can you link me to something, because I have applied this patch and it works as expected

Eitan Traurig (EitanSomething) reclaimed this revision.EditedJan 16 2020, 9:44 PM

JPEG files are in files of 8x8 but if it worked before it might be that ffmpeg handled it by adding a buffer and stores what the actual dimensions are.This was probably needed when ffmpeg didn’t create the buffer but now that it does(I’m assuming this because we had no problems with files that weren’t multiple of 8) we should remove this ‘hack’ because it will probably scale incorrectly with part of the buffer showing because it thinks the video dimensions are bigger that what it actually is.

Where I got the information that it needs to be 8x8
https://dsp.stackexchange.com/questions/35339/jpeg-dct-padding

This revision is now accepted and ready to land.Jan 16 2020, 9:44 PM

I know, that jpeg encoding works on 8x8 blocks, that's why I didn't question these lines too much. If this was ever limitation for MJPEG I would expect at least some historic document describing that.

This is 17x17 pixels MJPEG video created with blender as a "proof"

I know, that jpeg encoding works on 8x8 blocks, that's why I didn't question these lines too much. If this was ever limitation for MJPEG I would expect at least some historic document describing that.

This is 17x17 pixels MJPEG video created with blender as a "proof"

I don’t have my computer right now so I can’t test it but if it works for you I have no problem committing it.

Sybren A. Stüvel (sybren) requested changes to this revision.Jul 21 2020, 3:00 PM

There are still size requirements for various codecs. Here is an example invocation of ffmpeg:

% ffmpeg -i input.mkv -c:v h264 -vf scale=15x17 output-15x17.mkv
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
...
[libx264 @ 0x55573aa25740] width not divisible by 2 (15x17)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

I think this should be handled properly before removing that particular code.

This revision now requires changes to proceed.Jul 21 2020, 3:00 PM

There are still size requirements for various codecs. Here is an example invocation of ffmpeg:

% ffmpeg -i input.mkv -c:v h264 -vf scale=15x17 output-15x17.mkv
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
...
[libx264 @ 0x55573aa25740] width not divisible by 2 (15x17)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

I think this should be handled properly before removing that particular code.

Currently proxy building engine is using MJPEG codec exclusively but you have tested h264.

Can you explain in bit more detail what would be better solution?

Currently proxy building engine is using MJPEG codec exclusively

Ah there we go, that was what I was missing. And it's right there under the "Show 20 Lines" button 😴

This revision is now accepted and ready to land.Aug 5 2020, 11:54 AM
Sybren A. Stüvel (sybren) retitled this revision from Remove Resolution limitation to Remove VSE Strip Proxy Resolution limitation.Aug 5 2020, 11:55 AM

PS: a better patch description would have helped tremendously. Especially when it would link to the specification that states the MJPEG requirements for width & height.

From the code side looks good to me.
But indeed as Sybren mentioned the description (or, commit message) deserves more explanation.

@Richard Antalik (ISS), don't think @Eitan has commit access. Do you mind making sure this patch gets ocmmitted?

@Richard Antalik (ISS), don't think @Eitan has commit access. Do you mind making sure this patch gets ocmmitted?

Yes, will commit.

Ah there we go, that was what I was missing. And it's right there under the "Show 20 Lines" button 😴

Sorry, I assumed that this is widely known fact.

PS: a better patch description would have helped tremendously. Especially when it would link to the specification that states the MJPEG requirements for width & height.

I could not find any requirements or limitations for width and height for this codec, will look again and try to quote + add link if I find anything relevant.

This revision was automatically updated to reflect the committed changes.