cliveontoast / GoMoPho

Google motion photos video extractor
GNU General Public License v3.0
120 stars 12 forks source link

Feature request: GIF instead of MP4 #3

Closed augustseptember closed 5 years ago

augustseptember commented 6 years ago

Hi @cliveontoast, would it be possible for you to implement GIF extraction instead of MP4?

As a workaround for ubuntu 18.04 it is possible to convert mp4 to gif with this command: ffmpeg -i MVIMG_1234.mp4 -r 15 -vf scale=512:-1 Output.gif (source with explanation of the values: https://askubuntu.com/a/837574)

cliveontoast commented 6 years ago

I'll have to think about how to do this one. My first google searches on ffmpeg and .NET integration.. makes it look not easy just yet.

cliveontoast commented 5 years ago

hi @augustseptember, I've done some looking into this. There is a pretty awesome FFmpeg .net core wrapper https://github.com/tomaszzmuda/Xabe.FFmpeg It even downloads the binaries if they can't be found. In Window's this works a treat, but with Linux, once downloaded.. it can't be executed without a chmod.

 mint@mint:/tmp/GoMoPho$ ls -la /home/mint/.local/share/FFmpeg/
total 125004
drwxrwxr-x  2 mint mint     4096 Nov 25 17:39 .
drwx------ 15 mint mint     4096 Nov 25 18:36 ..
-rw-rw-r--  1 mint mint 63971848 Jun 19 06:32 ffmpeg
-rw-rw-r--  1 mint mint 63873544 Jun 19 06:32 ffprobe
-rw-rw-r--  1 mint mint       22 Nov 25 17:39 version.json

By default this wrapper does the following for GIF -n -threads 4 -loop 0 -map 0:0

Which for me, creates GIF files that are about 4 times the size of the mp4, so not super great.

Would you prefer to have something in the application's config that has a default.. of say what you wanted -r 15 -vf scale=512:-1 i.e.

<configuration>
  <appSettings>
    ...
    <add key="ffmpegParameters" value=" -r 15 -vf scale=512:-1 "/>
  </appSettings>
</configuration>
cliveontoast commented 5 years ago

This appears to work well in this version. https://github.com/cliveontoast/GoMoPho/releases/tag/v1.4-alpha.1

Things for me to consider is how to allow customised ffmpeg options, as the default currently makes GIF that are larger than the original MP4 files!

cliveontoast commented 5 years ago

Completed in v1.4.1