NickeManarin / ScreenToGif

🎬 ScreenToGif allows you to record a selected area of your screen, edit and save it as a gif or video.
http://www.screentogif.com
Microsoft Public License
23.99k stars 2.2k forks source link

[Feature Request] Add customizable import settings for FFMPEG #1251

Open Dephrilibrium opened 1 year ago

Dephrilibrium commented 1 year ago

Is your feature request related to a problem? Please describe. I have a raspberry pi cam which I use to stream a fabrication process to my network. For presentations I want to convert the long videos (up to a few hours) into a short <1min timelapse video.

The network-stream I've captured via VLC into an avi-file. When the avi-file is opened afterwards, VLC tells me the avi has a broken index. That's why I converted it to mp4 using xMediaRecode. This fixes the broken index message and I tried to import the new MP4 to screen2gif.

When starting the import using FFMPEG, I noticed, that FFMPEG stop importing after a few seconds. I observed this by checking the CPU load of the ffmpeg-process in the task-manager. It starts with 80-100% and drops back to idle (1-5%) after a few seconds. I tried to wait for more than 30 minutes, but the progress bar of screen2gif was not doing any progress anymore.

Since screen2gif didn't showed me any output what's going on, I tried to use it directly via powershell. Using:

./ffmpeg -i "<Path>\<to>\<video>\Saphir Segmented Cut.mp4" -vf fps=1/3 "<Path>/<to>/<extracted>/img_%06d.png"

With this command FFMPEG extracted without any problems and, in addition, I just got the wanted timelapseframes, instead of importing all frames, which most of them are deleted afterwards directly.

Describe the solution you'd like Therefore, options or a textbox to customize the import process with FFMPEG would be great. Especially the fps-option of FFMPEG which allows the extraction of one frame each Nth second, e.g.: fps=1/4 extracts one frame all 4 seconds.

Describe alternatives you've considered I used FFMPEG via powershell and was able to extract just the frames I need for my timelapse. These I imported than as a image sequence into screen2gif to fine-tune the frame duration and create a timelapse-MP4

Additional context

NickeManarin commented 12 months ago

Nice feature request!

I could also use the improved framerate controls for the normal import process as well. Maybe I can add something like what's used for the recorder, a field for numeraical values and a selector with perSecond/perMinute/perHour.

Dephrilibrium commented 12 months ago

Heyho ,

thanks for the feedback. That would be great!

Just for completeness, for the moment I wrote myself a small workaround powershell script which asks for the

for the codeline of my initial issue comment: ./ffmpeg -i "<Path>\<to>\<video>\Saphir Segmented Cut.mp4" -vf fps=1/3 "<Path>/<to>/<extracted>/img_%06d.png"

Content of my FFMPEG_Extractor.ps1:

$vidPath = Read-Host -Prompt "Insert video path"
echo "Extracting images from: $vidPath"

$fps = Read-Host -Prompt "How much images (in FPS)"
echo "Extracting images every $fps FPS"

$imgPath = Read-Host -Prompt "Define a storepath for the images"
echo "Extracting to $imgPath"

echo "Running FFMPEG:"
echo "C:\ProgramData\ScreenToGif\ffmpeg.exe -i $vidPath -vf fps=$fps $imgPath\img_%06d.png"

C:\ProgramData\ScreenToGif\ffmpeg.exe -i "$vidPath" -vf fps=$fps "$imgPath\img_%06d.png"
Read-Host -Prompt "EOS. Hit enter to close..."

Kind regards, Deph