# JPG to movie (e.g. MKV), using FFMpeg
## Obtaining FFMpeg
On Windows, pre-compiled binary could be obtained via [gyan](https://www.gyan.dev/ffmpeg/builds/).
## Rename (for easier batch processing)
Using Windows File Explorer, select all files, sort them either by date or name, right click, and rename. Or one could try rename them manually.
The objective is s.t. all the pictures are named in the order one'd want them appear in the final movie.
E.g.
```
test (1).jpg
test (2).jpg
...
test (42069).jpg
```
## Command Line Options (Nvidia Hardware Accelerated)
``` powershell
# Windows Powershell or CMD.exe
D:\misc_programs\ffmpeg-6.1-full_build-shared\bin\ffmpeg.exe `
-hwaccel cuda -hwaccel_output_format cuda `
-f image2 -r 6 -i "S:\test\test (%d).jpg" `
-c:v hevc_nvenc -crf 23 `
D:\test\test_6fps.mkv
```
In particular, the `-r` option controls how many pictures per second (FPS), and `-crf` option controls the overall quality of output video, the _lower_ the number, the more details the video preserves, albeit with higher storage requirements.
Supposedly AMD on Windows should also work, but I'm lacking required GPU to try it out myself.
reference:
[stackoverflow](https://stackoverflow.com/questions/22965569/)
[nvidia](https://docs.nvidia.com/video-technologies/video-codec-sdk/12.0/ffmpeg-with-nvidia-gpu/index.html)
[Phoronix states AMD Hardware Acceleration with VA-API On Windows Is Possible](https://www.phoronix.com/news/FFmpeg-VA-API-Windows)
## Command Line Options (CPU only)
This method is the most universal, albeit with the cost of CPU temperature and encoding time.
``` powershell
D:\misc_programs\ffmpeg-6.1-full_build-shared\bin\ffmpeg.exe `
-f image2 -r 3 -i "S:\test\test (%d).jpg" `
-c:v libx265 -crf 23 `
D:\test\test_3fps.mkv
```