Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Find an example file in the current folder that follows the sequence pattern
- example_file=$(ls *.jpg | grep -E '\.[0-9]{4}\.jpg' | head -n 1)
- # Check if a matching file was found
- if [[ -z "$example_file" ]]; then
- echo "No files found matching the pattern <file_name>.####.jpg"
- exit 1
- fi
- # Extract the pattern by replacing the numeric part with %04d
- input_pattern=$(echo "$example_file" | sed -E 's/\.([0-9]{4})\.jpg$/\.%04d\.jpg/')
- # Convert the image sequence to MP4
- ffmpeg -framerate 30 -i "$input_pattern" -c:v libx264 -preset slow -crf 18 -pix_fmt yuv420p output.mp4
- echo "Conversion completed: output.mp4 created"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement