ffmpeg replaces freeconvert ezgif

ffmpeg replaces freeconvert ezgif

By medeb | personalblog | 1 Apr 2025


FFmpeg is a powerful command-line tool that excels at handling large MP4 video files, offering precise control over video processing. To convert an MP4 to a GIF, you can leverage FFmpeg's capabilities for frame extraction and palette generation. Subsequently, to achieve varying frame rates and animation effects, FFmpeg allows for selective frame removal. By removing every second, third, or fourth frame, you can create GIFs with different levels of smoothness and speed, tailoring the output to your specific needs. This local processing eliminates the need for uploading large files to online converters, saving significant internet bandwidth.

Once you have generated the desired GIF variations using FFmpeg, the next step is to compile them into a PDF document. PDF24, a free and versatile PDF toolkit, can be utilized for this purpose. Instead of relying on online services that might compress or alter the GIF quality, PDF24 allows for local conversion, preserving the original visual fidelity. You can import each GIF as a separate page into the PDF, effectively creating a slideshow-like document. This approach offers a convenient way to share and view the animated content without the need for specialized GIF viewers.

By combining FFmpeg's robust video processing capabilities with PDF24's PDF creation tools, you can efficiently manage large MP4 files and create custom GIF-based PDF documents entirely offline. This method significantly reduces reliance on internet data, ensuring faster processing times and maintaining control over the quality of your output. This workflow is particularly beneficial for users working with large video files or those with limited internet connectivity, providing a practical and efficient solution for local media manipulation.

param (
    [string]$InputFile
)

# Convertir la chaîne en objet FileInfo
$fileInfo = Get-Item $InputFile

# Paramètres
$outputName = $fileInfo.BaseName
$outputExtension = $fileInfo.Extension

# Conversion des formats vidéo non-MP4 en MP4
if ($outputExtension -in @(".flv", ".webm", ".avi", ".mov")) {
    Write-Output $outputName
    $ffmpegOutput = ffmpeg -i $InputFile -c:v libx264 -c:a aac -crf 18 -y "$outputName.mp4" 2>&1
    if ($LASTEXITCODE -ne 0) {
        Write-Error "Erreur ffmpeg (conversion en MP4) : $ffmpegOutput"
        return # Arrête le script en cas d'erreur
    }
    $InputFile = "$outputName.mp4"
    $outputExtension = ".mp4"
    # Mettre à jour l'objet FileInfo après la conversion en mp4
    $fileInfo = Get-Item $InputFile
    $outputName = $fileInfo.BaseName
}
if ($outputExtension -eq ".mp4") {
    # Convertir la vidéo en GIF 1 fps
$ffmpegOutput = ffmpeg -i $InputFile -vf "fps=1,scale=500:-1" -vsync 0 "$outputName.gif" 2>&1
if ($LASTEXITCODE -ne 0) {
Write-Error "Erreur ffmpeg (MP4 vers GIF) : $ffmpegOutput"
return
}

$outputExtension=".gif"
}


# Vérifier si le fichier est un GIF ou une vidéo
if ($outputExtension -eq ".gif") {
  $frames = @(2, 3, 4)
  foreach ($frame in $frames) {
    $outputFile = "$outputName" + "_$frame.gif"
    $ffmpegOutput = ffmpeg -i "$outputName.gif" -vf "select='not(mod(n,$frame))'" -fps_mode passthrough $outputFile 2>&1
    if ($LASTEXITCODE -ne 0) {
      Write-Error "Erreur ffmpeg (GIF $frame) : $ffmpegOutput"
      return
    }
  }
}f8894e927bd14cbbfd1aa6c1d4552c4c6830151bd9d4996015d489632a09863a.png

How do you rate this article?

2



personalblog
personalblog

My daily experience in crypto world

Publish0x

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.