-
Crie um script com o nome
export_flags
#!/bin/bash srt_file_name="${1%\.*}".srt if [ -f "$srt_file_name" ]; then FLAGS="-i $srt_file_name -sub_charenc CP1252 -vcodec copy -acodec copy" else FLAGS="" fi export FLAGS="$FLAGS"
-
Torne-o executável
chmod +x export_flags
-
Iniciar um teste com
source export_flags your_mkv echo $FLAGS
E.G.
source export_flags SampleVideo_1080x720_1mb.mkv echo $FLAGS
a saída deve ser algo como isto
-i SampleVideo_1080x720_1mb.srt -sub_charenc CP1252 -vcodec copy -acodec copy
-
Use quatro
find
commandfind . -type f -name "*.mkv" -exec bash -c 'source export_flags ""; ffmpeg -i "" $FLAGS "${1%\.*}".mkv' _ {} \;
No meu caso eu tenho isso
ffmpeg version 2.5.8-0ubuntu0.15.04.1 Copyright (c) 2000-2015 the FFmpeg developers built with gcc 4.9.2 (Ubuntu 4.9.2-10ubuntu13) configuration: --prefix=/usr --extra-version=0ubuntu0.15.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --shlibdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --enable-shared --disable-stripping --enable-avresample --enable-avisynth --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libshine --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libwavpack --enable-libwebp --enable-libxvid --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzvbi --enable-libzmq --enable-frei0r --enable-libvpx --enable-libx264 --enable-libsoxr --enable-gnutls --enable-openal --enable-libopencv --enable-librtmp --enable-libx265 libavutil 54. 15.100 / 54. 15.100 libavcodec 56. 13.100 / 56. 13.100 libavformat 56. 15.102 / 56. 15.102 libavdevice 56. 3.100 / 56. 3.100 libavfilter 5. 2.103 / 5. 2.103 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 3.100 / 53. 3.100 Input #0, matroska,webm, from './SampleVideo_1080x720_1mb.mkv': Metadata: ENCODER : Lavf56.15.102 Duration: 00:00:00.32, start: 0.080000, bitrate: 2642 kb/s Stream #0:0: Video: h264 (High), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 50 tbc (default) Metadata: ENCODER : Lavc56.13.100 libx264 Stream #0:1: Audio: vorbis, 48000 Hz, 5.1, fltp (default) Metadata: ENCODER : Lavc56.13.100 libvorbis Input #1, srt, from './SampleVideo_1080x720_1mb.srt': Duration: N/A, bitrate: N/A Stream #1:0: Subtitle: subrip File './SampleVideo_1080x720_1mb.mkv' already exists. Overwrite ? [y/N]