ffmpeg - 我如何创建一个bash循环来将mkv文件转换为mp4

时间:2017-09-07 17:23:01

标签: linux bash ffmpeg mp4 mkv

您好我设计了一个命令,允许我将具有多音轨和字幕的mkv文件转换为保存所有视频轨道和字幕的mp4文件

现在我想制作一个bash循环来转换整个目录,但我做的bash没有工作

#!/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

终端它把这个结果扔给我

    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

你建议我改变我的命令 这是原始命令

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

0 个答案:

没有答案