Resizing a Fulldome Video

Resizing a Fulldome Video


Ken Scott
Digital Chaotics LLC

Mac/Linux script contributed by
Sascha Kriegel
Planetarium Hamburg


In this post I’ll show you how to convert a video with one size (e.g., 2048 x 2048 pixels) into a new file containing video that’s a different size (e.g., 1200 x 1200 pixels).

The video files for sale here (DomeSavers », DomeLoops », and DomeArts ») are sized to fit the size ranges of most dome theaters, but we can’t support them all. Heck, we can’t even keep track of them. Sometimes you’ll just have to download the one whose size is closest to the requirements of your projection system, and then resize them to fit.

Keep in mind that down-sizing a video means you’ll lose some pixels. There’s just no way around it. You’re throwing them away. To keep the loss to a minimum you should convert from big to small, meaning that you’ll use a video file with larger dimensions to create one with smaller dimensions. For example, if you want to create a 1200 x 1200 video file, then 2048 x 2048 is a good size to start with. Starting with an even larger file won’t hurt, either. The conversion process below tries to keep as much information as possible by averaging the pixels in the source file, but there’s only so much it can do. Bigger is better.

Instructions:

  1. Download and install the free video conversion tool, FFMPEG [How to install FFMPEG »]
  2. Make sure it’s in your system PATH, so that you can run it from a command line.  (“add to path” from Google:  Windows »  Mac »  Linux »)
  3. Create an empty text file called “resize-src-dst-x-y.cmd” (Windows »  Mac »  Linux »)
  4. Open the new file, copy the appropriate script below into it, and save it.
  5. Mac/Linux only: Make the file executable:  sudo chmod 555 resize-src-dst-x-y.sh
  6. Ensure that the directory containing it is in your system PATH, too.
  7. Open a command-line window (Windows »  Mac »  Linux »)
  8. Execute:
    • Windows: resize-src-dst-x-y my_video.mp4 my_resized_video.mp4 1200 1200
    • Mac/Linux: ./resize-src-dst-x-y.sh my_video.mp4 my_resized_video.mp4 1200×1200
    (Note the minor difference between the two command-lines above. The Mac/Linux line has an ‘x’ in the dimensions, while the Windows line does not.)
  9. Wait for it to finish. (It could take a while.)

This will create a new file called “my_resized_video.mp4” using “my_video.mp4” as the input. The resized video will be 1200 x 1200 pixels. If the input video file had audio, then it will also be included in the output.

Quick note:If you do make the mistake of double-clicking on the icon for ‘resize-src-dst-x-y.cmd/.sh’, then you might see a command-line window flash on the screen very briefly. What happened is this: double-clicking on a ‘.cmd’ file causes your computer to try to execute the command. Double-clicking doesn’t give it the parameters it needs, so it runs without doing anything. Nothing bad happened. It just didn’t work. So don’t do that.

The “resize-src-dst-x-y” Script:

Windows

REM resize-src-dst-x-y.cmd
REM
REM Reads a MOV or MP4 file, resizes the frames as specified, and writes them to a new video file.
REM Should work with most popular video file formats, but only MOV and MP4 have been tested.
REM Any audio is copied into a 320kbps stream.
REM
REM ex: resize-src-dst-x-y src.MOV dst.MP4 1920×1920

set srcFile=%1
set dstFile=%2
set dstSizeX=%3
set dstSizeY=%4

ffmpeg -i %srcFile% -b:a 320K -c:v libx264 -preset veryslow -crf 18 -pix_fmt yuv420p -s %dstSizeX%x%dstSizeY% %dstFile%

Mac/Linux

#!/bin/sh
# resize-src-dst-x-y.sh
#
# Reads a MOV or MP4 file, resizes the frames as specified, and writes them to a new video file.
# Should work with most popular video file formats, but only MOV and MP4 have been tested.
# Any audio is copied into a 320kbps stream.
#
# ex: ./resize-src-dst-x-y.sh src.MOV dst.MP4 1920×1920

export srcFile=$1
export dstFile=$2
export dstSize=$3

ffmpeg -i $srcFile -b:a 320K -c:v libx264 -preset veryslow -crf 18 -pix_fmt yuv420p -s $dstSize $dstFile

Please feel free to suggest any improvements that I can make in the scripts or the instructions on their use by sending an email to [ken.scott at digitalchaotics dot com].