Logo Cinquin Andy Signature

Midjourney Video to Seamless Loop using FFmpeg - Complete Automation Script

Développeur Freelance - Logo

The sites and the associated resources.

Article Content

Midjourney Video to Seamless Loop using FFmpeg - Complete Automation Script

Posted on  - June 18, 2025 by Andy Cinquin

MidjourneyFFmpegSeamless LoopAI VideoWebP AnimationVideo ProcessingAutomationBash Script

An automatic Bash script to convert videos to seamlessly looping animated WebP files on Fedora, integrated into Nautilus context menu.

✨ Features

  • Automatic conversion: Converts any video to animated WebP
  • Seamless looping: Creates fade effect between end and beginning for perfect loops
  • Context menu: Accessible directly via right-click on video files
  • Notifications: Shows progress and results via system notifications
  • Auto cleanup: Automatically removes temporary files
  • Quality optimization: Balanced settings between quality and file size

🎯 Supported Formats

Input: MP4, AVI, MKV, MOV, WMV, FLV, WebM, 3GP, M4V Output: Animated WebP (30fps, infinite loop)

📋 Requirements

  • Fedora Linux (tested on Fedora 38+)
  • GNOME Desktop Environment with Nautilus
  • Sudo access for installation

🚀 Quick Installation

  1. Create the files below in a folder:

  2. Copy the content of each script (see sections below)

  3. Make the installation script executable:

  4. Run the installation:

    ./install.sh
    

🎬 Usage

  1. Open Nautilus (Files)
  2. Navigate to a folder containing videos
  3. Right-click on any video file
  4. Select "Convert to Animated WebP"
  5. Wait for conversion to complete (notifications shown)
  6. WebP file will be created with _loop.webp suffix

Via command line

video-to-webp.sh 

📁 COMPLETE SCRIPTS TO CREATE

1. 📝 File: video-to-webp.sh


2. 🗂️ File: video-to-webp.desktop


3. 🚀 File: install.sh


4. 🧪 File: test.sh


📋 INSTALLATION INSTRUCTIONS

🚀 One-Time Installation:

you can also, copy the script into your folder share nautilus.
for me it's "/home/andycinquin/.local/share/nautilus/scripts"
Pasted image 20250619004116.png

⚙️ Advanced Configuration

Modify settings in video-to-webp.sh:
FPS_INTERMEDIATE=24    

🔧 Conversion Process

The script automatically performs 3 steps:
  1. Normalization: Convert to constant framerate (24fps)
  2. Seamless loop: Create fade between end and beginning
  3. WebP export: Final conversion to animated WebP (30fps)

🐛 Troubleshooting

Context menu doesn't appear

pkill nautilus && nautilus &

FFmpeg not found

Permission errors

Complete reinstallation

📊 Example Results

  • 10MB MP4 video~2-3MB WebP
  • Visual quality: Excellent for short animations
  • Conversion time: ~30 seconds for 10 seconds of video
  • Compatibility: Works in all modern browsers

🎯 Ideal Use Cases

  • GIF replacement: Reduced size, superior quality
  • Web animations: Optimized performance
  • Social media: Modern and efficient format
  • Presentations: Smooth and lightweight animations

🛠️ Uninstallation

To completely remove the system:

📁 File Structure

video-to-webp-converter/
├── video-to-webp.sh          # Main conversion script
├── video-to-webp.desktop     # Nautilus action file
├── install.sh                # Automatic installation script
└── test.sh                   # Test and verification script

📝 Technical Notes

  • Seamless loop: Uses FFmpeg's xfade for imperceptible fade
  • Optimization: CRF 18 to balance quality/size
  • Cleanup: Automatic removal of temporary files
  • Security: Input validation and robust error handling

🤝 Contributing

Feel free to report bugs or suggest improvements!

Author: Assistant
License: MIT
Version: 1.0.0
Complete portable kit! Copy each script, install and enjoy one-click animated WebP conversion!



🚀 Thanks for reading!
If you enjoyed this article, feel free to share it around.

💡 Got an idea? Let's talk !

DEVELOP YOUR PROJECTS TOGETHER

An idea, a project? I'm here to answer your questions and help you.
I'd be delighted to discuss your project with you!
Convert Midjourney Videos to Perfect Seamless Loops with FFmpeg