LearnMMD's NordGeit has done a terrific and detailed write-up about everything you need to know to get started with

FFMPEG

... so detailed a write-up that it's difficult to see exactly how easy it is for you to simply

Use FFMPEG... a Quick-Start Guide



File Mangement...


I downloaded the ZIP folder, moved it to my desktop and then extracted the folder onto my desktop. I slid the original ZIP folder into that folder, just for safe keeping.
So... my FFMPEG folder had these contents.




I then created a New Folder called FFMPEG and I slid my old folder into it.
... I then copied the bin folder and pasted it into my FFMPEG folder so everything looked like this:


The tutorial's author, NordGeit, recommends that you save the folder to your C drive.

You will see there in that image, above, that I have moved my entire FFMPEG folder onto my computer's E drive. My system has a 120GB SSD C drive and I am always trying to shuffle everything off of it and onto to the 1T E: drive.

Now it is easy for the system (and you) to find the BIN folder inside the FFMPEG folder.


We are ready to use FFMPEG

The author suggests that you install the FFMPEG software on your computer so that you don't have to invoke its path every time you use it.

For my use, I did not "install" anything. As if using MikuMikuDance, I simply let FFMPEG run from inside its folder. 


The COMMAND PROMPT


Any of you who have done "coding" will know how to get to the Command Prompt...

The author mentions that rather than the Command Prompt, you can also use Powershell. That one colours some text; can make it easier to read.




... and then see the Command window...



See that it comes up looking at your C drive... you will want to be in the drive where you put the FFMPEG folder, so, for me, I type in E: and press return to get to the E drive.





We are ready to use FFMPEG

What do you want to do?

Create MMD Background Video


First we will convert an MP4 video into a file that MikuMikuDance can use as a background video.

MMD wants to see a video in the RAW format so we will convert our MP4 into a RAW AVI file. Here is the command line we will use:


FFMPEG\bin\ffmpeg -i "E:\Reggies-Videos\Really Bad Boy - Red velvet.mp4" -c:v rawvideo -f avi -pix_fmt yuv420p -s 1280X720 C:\Users\PC\Desktop\ReallyBadBoy.avi

Let's break it down...
FFMPEG\bin\ffmpeg
-i "E:\Reggies-Videos\Really Bad Boy - Red velvet.mp4" -c:v rawvideo -f avi -pix_fmt yuv420p
-s 1280X720 C:\Users\PC\Desktop\ReallyBadBoy.avi

FFMPEG\bin\ffmpeg     tells the system to go get the bin ffmpeg

-i "E:\Reggies-Videos\Really Bad Boy - Red velvet.mp4"     tells the system where to find the source video (as explained below, no word spaces are allowed in a phrase. If you have word spaces in your title, you will enclose the entire phrase within "double quote marks".)

-c:v rawvideo     identifies the codec

-f avi     Forces a specific format. Only relevant here when making MMD-compatible AVI files.


-pix_fmt yuv420p
    Identifies pixel colour format. Relevant for MMD here.


-s 1280X720
    identifies the frame size

C:\Users\PC\Desktop\ReallyBadBoy.avi
    identifies the name./location of the new file we are making.

What I do...

... is save that line as a text file so that I can always use that line and
just replace the two variables: the Source video and the Target video.


To find the address of your source video, create a Shortcut to your video by right-clicking your video file and choosing Create Shortcut. Then right-click the new Shortcut, choose Properties, and SEE the video's address, already selected, just Control-c to copy that address.



... and I always set my Destination to my Desktop so all I have to do is Name my output file.

I paste that command line into a .TXT window and edit the line for my needs...

FFMPEG\bin\ffmpeg -i "C:\Users\PC\Desktop\Kiss Me Steam-Punk1.mp4" -c:v rawvideo -f avi -s 1280X720 C:\Users\PC\Desktop\Kiss-Me.avi


Copy that command line and paste it into your Command Prompt window...



Press ENTER and FFMPEG will make the conversion!



We would be DONE except that when I look at my new video on my desktop, I see that it is over TEN GB and, for a background video to run smoothly, MMD wants it to be under 1GB file size!




... MMD wants the Background Video to be less than 1 GB. So, I will resize my output video by changing that Command Line.

The part of the command line to change is 
-s 1280X720


I will keep the 16x9 screen size... and also know that MMD needs the screen proportion to have both numbers divisible by 8... so

YouTube's choice of sizes are:

1080p:   19201080
720p:   1280720
480p:   854480
360p:   640360
240p:   426240

I will try the 640x360 size...

FFMPEG\bin\ffmpeg -i "C:\Users\PC\Desktop\Kiss Me Steam-Punk1.mp4" -c:v rawvideo -f avi
-pix_fmt yuv420p -s 640x360 C:\Users\PC\Desktop\Kiss-Me.avi

... and run it, again...

NOW it's 2.7GB



... STILL too large for an MMD Background video.

I will try for the smaller size of a 426x240...



FFMPEG\bin\ffmpeg -i "C:\Users\PC\Desktop\Kiss Me Steam-Punk1.mp4" -c:v rawvideo -f avi
-pix_fmt yuv420p -s 426x240 C:\Users\PC\Desktop\Kiss-Me.avi

The new file is 1.17GB... still too large... but I will try it out with MMD:
... the new AVI file I made works just fine as a Background Video in MMD!




What may happen if your Background AVI file is bigger than 1GB is that the background video may not run through the full-length of the animation. It may lock-up at some point... but my new file is working with MMD!

Convert a video file into an MP4


The command line I use is this one... NordGeit's FFMPEG tutorial can help you to select the actual command line to fit your needs.

FFMPEG\bin\ffmpeg -i E:\Reggies-Videos\CameraViewAngle.avi -c:v libx264 -b:v 1024k -s 1280X720 C:\Users\PC\Desktop\EverglowAA.mp4

The author recommends using -b:v 2048k -s 1920x1080  especially if there's more moving stuff around.
And you can also leave out this phrase so as not to resize your video at all.


Go ahead and copy that command line and paste it into a TXT file so that you will always have it for reference.

Note that the command line uses word spaces to separate the components of the command. If your video title or file location includes word spaces, you will need to enclose the whole phrase inside of double quote marks ".


FFMPEG\bin\ffmpeg -i "C:\Users\PC\Desktop\Kiss Me Steam-Punk1.mp4" -c:v rawvideo -f avi -s 1280X720 C:\Users\PC\Desktop\Kiss-Me.avi

Take a look at the command lines used above and see the use of the quote-marks. If you use the Create Shortcut method to find the adddress of your video (or just drag the file into the Terminal window), the quotes will already be there if needed.

REDUCE the SIZE of a File...


You can convert an MP4 to an MP4 resulting in a smaller file size.

FFMPEG\bin\ffmpeg -i "E:\Reggies-Videos\Really Bad Boy - Red velvet.mp4" -c:v libx264 -b:v 1024k -s 1280X720 C:\Users\PC\Desktop\ReallyBadBoy.mp4

FFMPEG offers SO MUCH MORE!

Bookmark NordGeit's FFMPEG tutorial and keep that page handy; once you start using FFMPEG, you will wonder why the world keeps this software hidden away!

Have fun with MikuMikuDance!