Skip to content

Instantly share code, notes, and snippets.

@lewangdev
Last active June 30, 2023 06:33
Show Gist options
  • Select an option

  • Save lewangdev/4949643f82573431478f2c5a2ae753d0 to your computer and use it in GitHub Desktop.

Select an option

Save lewangdev/4949643f82573431478f2c5a2ae753d0 to your computer and use it in GitHub Desktop.

Revisions

  1. lewangdev revised this gist Jun 30, 2023. 1 changed file with 14 additions and 2 deletions.
    16 changes: 14 additions & 2 deletions convert-mkv-to-mp4.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,15 @@
    for i in *.mkv; do
    ffmpeg -i "$i" -c:v libx264 -crf 23 -c:a aac "${i%.*}.mp4"
    #!/bin/bash

    if [ -z "$1" ]
    then
    echo "Please provide the directory as an argument."
    exit 1
    fi

    for file in "$1"/*.mkv
    do
    echo "Processing $file"
    filename=$(basename -- "$file")
    filename="${filename%.*}"
    ffmpeg -i "$file" -c:v libx264 -crf 23 -c:a aac "$1/$filename.mp4"
    done
  2. lewangdev created this gist Jun 30, 2023.
    3 changes: 3 additions & 0 deletions convert-mkv-to-mp4.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    for i in *.mkv; do
    ffmpeg -i "$i" -c:v libx264 -crf 23 -c:a aac "${i%.*}.mp4"
    done