2
$\begingroup$

I record an area of my desktop for upload to youtube with ffmpeg the area is a 16x9 aspect ratio with a width of 2952x1458

I can upload this video to youtube and it plays properly but of course I need some editing, mainly to remove some junk frames from the beginning and end of the video.

I load up blender vse and make the preferences changes enter image description here

and go down and edit the encoding settings as well enter image description here

mainly to go along with youtube recommended video settings

The problem is that when I try to hit animation, blender complains that this video's height is not divisible by 2. enter image description here

When I change the percentage below x & y to 100% from 50% then the output video has horrible pillow boxing. As you can see from this screenshot: enter image description here

How can I actually get blender to just take the video that I recorded, cut of the few parts that I don't need and export the video, in pretty much the same way it came in, while avoiding these issues?

Edit I grab the screen with this ffmpeg command ffmpeg -an -f "x11grab" -framerate "120" -video_size "2594"x"1458" -i :0.0+5,+257 -c:v "libx264" -crf "16" -bf "2" -flags "+cgop" -movflags "faststart" -pix_fmt "yuv420p" -preset "ultrafast" "$1".mkv

here is the raw upload: https://www.youtube.com/watch?v=2NzSlo3knbk here is the out output from blender: https://www.youtube.com/watch?v=LYUTu6UV5ug

these are the export settings that I setup in blender render preferences enter image description here enter image description here

$\endgroup$
3
$\begingroup$

EDIT: The most direct answer to the question is the discrepancy between the capture dimensions and the export dimensions. The video is being captured in 2594*1458, which is a 16:9 ratio, whereas blender is exporting at 2952*1458, which is not a 16:9 ratio. It is likely to be a simple typo. This ratio difference is causing the letterboxing on the exported video.

sambler: Requiring dimensions to be divisible by two is a limitation of the H.264 encoder in Blender.

Original post

Render Dimensions:

The first problem here is blender downsizes the video to a non-divisible-by-two height. A simple way around this is to bump your scaling percentage up or down one or two percent. A better way would be to manually input dimensions instead of using the percentage slider. Blender can do math in text input fields, so you can simply put 2952/2 into the X dimension and 1458/2 in Y. If the result is an odd number, just bump it up one pixel. Amaranth Toolset (included in blender) has a nifty tool to show the final resolution of the render. Enable it in your user prefs and a new line of dimensions will show up in the render properties:

enable resolution

Letterboxing:

The second problem is letterboxing, the black bars on the top and bottom of the video. This is actually Youtube's fault because your video isn't a perfect 16:9 aspect ratio. To see your aspect ratio, simply divide your width by your height, in this case 2952/1458 = 2.024... Compare this width/height ratio with that of HD video: 1920/1080 = 1.777... You can see now the ratios are different. This difference ends up as letterboxing on Youtube. Pillarboxing occurs when your video is more square than the 16:9 player.

There are three ways you can deal with this difference: upload the video in its original aspect ratio and accept the letterboxing Youtube gives you; crop the sides off the footage to get a perfect 1.777... ratio on your output; distort the footage to fit within the desired ratio.

Personally, I would take the letterboxing because it means the entire area of my footage is visible without distortion, especially because the whole desktop is important.

Distortion:

If you absolutely do not want letterboxing, but still want all of the footage, you will need to distort the footage to fit in the 1.777 ratio. To do this, simply change your render output dimensions to a 16:9 ratio (2592/1458, 1920/1080, 1280/720, etc.). Blender distorts VSE strips to fit the render dimensions.

Cropping:

To make your video 16:9 ratio, your dimensions would need to be 2592 wide by 1458 tall (or some percentage of). A normal application would allow you to crop the video, but blender does not. You will need to use a transform layer on your VSE footage to compensate the aspect ratio difference between your footage and the new render dimensions.

Start out with your footage in the VSE. Change your render dimensions to 2592 wide by 1458 tall. Your footage will look distorted; this is expected. Select your strip in the VSE and add a transform layer effect. Open the properties region for the strips by pressing N. The Effect Strip panel contains scale controls for X and Y dimensions. The one you need to worry about is X. Input this value into X: 1.139 - this corrects the ratio difference. I came to this number by dividing your original ratio (2.024...) by the desired ratio (1.777...). If you have multiple strips, you will need to do this for each one because the effect strip is linked to only a single input strip.

aspect correct scale

Final Thoughts:

Letterboxing may be ugly, but it is a necessary evil if you don't want to lose information. Cropping may be more acceptable for camera footage. I can't think of a time when distortion is acceptable.

$\endgroup$
  • $\begingroup$ The thing is, when I record my desktop with ffmpeg and upload that video directly to youtube it looks just fine, no artifacts or anything. $\endgroup$ – user1610950 May 6 '16 at 0:12
  • $\begingroup$ The thing is, when I record my desktop with ffmpeg and upload that video directly to youtube it looks just fine, no artifacts or anything. Once I put the video in blender vse to do a few edits and cuts, then export the video from blender vse that's where the issue crop up. Even if I click on the clip and click set render size. $\endgroup$ – user1610950 May 6 '16 at 0:18
  • $\begingroup$ I'm not understanding where you're getting 2952*1458 as a 16:9 ratio. That's not 16:9. My guess is you have some kind of anamorphic transform somewhere. Can you post a sample for us to look at? $\endgroup$ – Italic_ May 6 '16 at 0:26
  • $\begingroup$ I just edited the question, adding two video links to youtube and the export settings from blender. $\endgroup$ – user1610950 May 6 '16 at 1:15
  • 1
    $\begingroup$ This is a known limitation when using H.264 for encoding video. While there are variations available when encoding H.264, we don't have access to them in blender. The encoding options used by blender requires a height that is divisible by 2. $\endgroup$ – sambler May 6 '16 at 4:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.