Skip to content

Instantly share code, notes, and snippets.

@abhishek77in
Last active May 19, 2024 12:41
Show Gist options
  • Save abhishek77in/4604620 to your computer and use it in GitHub Desktop.
Save abhishek77in/4604620 to your computer and use it in GitHub Desktop.
Convert video from MP4 format to FLV format.

Convert video from MP4 format to FLV format

$brew install ffmpeg
$ffmpeg -i input_file.mp4 -f flv output.flv
  • ffmpeg - runs the program
  • -i input_file.mp4 - input file
  • -f flv - force format followed by format
  • output.flv - output file

source

@Taialt97
Copy link

This script will convert all MP4 files in the current directory to FLV format.

  1. Create new file:
nano convert_all_to_flv.sh
  1. Paste the script into the file:
#!/bin/bash

# Loop through each MP4 file in the current directory
for input_file in ./*.mp4; do
  # Extract the base name of the file (without extension)
  base_name=$(basename "$input_file" .mp4)
  # Set the output file name with .flv extension
  output_file="./${base_name}.flv"
  # Convert the file to FLV format
  ffmpeg -i "$input_file" -c:v libx264 -c:a aac "$output_file"
done
  1. Save and exit the editor (press Ctrl+X, then Y, then Enter).
  2. Make the script executable:
chmod +x convert_all_to_flv.sh
  1. Run the script:
./convert_all_to_flv.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment