ffmpeg - how can i create a bash loop to convert mkv files to mp4

1.2k views Asked by At

Hello i designed a command that allow me to convert mkv files with multi audio track and subtitles to mp4 files conserving all video tracks and subtitles

now i want to make a bash loop to convert a whole directory but the bash i made didnt work

#!/bin/bash
for t in *.mkv  
do
name=$(basename -s .mkv "$t")
ffmpeg –I "$t" -map 0 -c:a aac -strict -2 -c:s mov_text "$name.mp4"
done

the terminal its throwing me this results

    ffmpeg version N-75193-gf855353-Xtream-Codes Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
  configuration: --prefix=/root/FFmpeg/target --extra-cflags='-I/root/FFmpeg/target/include -static' --extra-ldflags='-L/root/FFmpeg/target/lib -lm -static' --extra-version=Xtream-Codes --disable-debug --disable-shared --enable-libx265 --enable-static --extra-cflags=--static --disable-ffplay --disable-ffserver --disable-doc --enable-librtmp --enable-gpl --enable-pthreads --enable-postproc --enable-libass --enable-gray --enable-runtime-cpudetect --enable-gnutls --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-bzlib --enable-zlib --enable-version3 --enable-libvpx --enable-libxavs --disable-devices --extra-libs='-lrtmp -lnettle -lhogweed -lgmp -lssl -lcrypto -lz -lc -ldl'
  libavutil      55.  2.100 / 55.  2.100
  libavcodec     57.  1.100 / 57.  1.100
  libavformat    57.  0.100 / 57.  0.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6.  1.100 /  6.  1.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.100 /  2.  0.100
  libpostproc    54.  0.100 / 54.  0.100
[NULL @ 0x2f89a20] Unable to find a suitable output format for '–I'
–I: Invalid argument
ffmpeg version N-75193-gf855353-Xtream-Codes Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
  configuration: --prefix=/root/FFmpeg/target --extra-cflags='-I/root/FFmpeg/target/include -static' --extra-ldflags='-L/root/FFmpeg/target/lib -lm -static' --extra-version=Xtream-Codes --disable-debug --disable-shared --enable-libx265 --enable-static --extra-cflags=--static --disable-ffplay --disable-ffserver --disable-doc --enable-librtmp --enable-gpl --enable-pthreads --enable-postproc --enable-libass --enable-gray --enable-runtime-cpudetect --enable-gnutls --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-bzlib --enable-zlib --enable-version3 --enable-libvpx --enable-libxavs --disable-devices --extra-libs='-lrtmp -lnettle -lhogweed -lgmp -lssl -lcrypto -lz -lc -ldl'
  libavutil      55.  2.100 / 55.  2.100
  libavcodec     57.  1.100 / 57.  1.100
  libavformat    57.  0.100 / 57.  0.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6.  1.100 /  6.  1.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.100 /  2.  0.100
  libpostproc    54.  0.100 / 54.  0.100
[NULL @ 0x5e25fe0] Unable to find a suitable output format for '–I'
–I: Invalid argument

what do you suggest me to change to my command this is the original command

ffmpeg -i INPUT.mkv -map 0 -c:a aac -strict -2 -c:s mov_text OUTPUT.mp4
0

There are 0 answers