want a batch convert ts to mp4. I have this code, it doesn't work
by ejames82 from LinuxQuestions.org on (#5SNFF)
hi,
I am hoping to find something to run in the linux mint terminal that will convert all of the .ts files that it finds to .mp4 in a directory.
while searching google I found this:
------------------------------------------------------------------------
for %%f in (*.ts) do (
ffmpeg -i "%%f" -c:v h264_nvenc -c:a copy "%%f.mp4"
)
pause
------------------------------------------------------------------------
when I ran it in the terminal, I got this:
ed@ed-MS-7759 ~/Desktop/jsdtd $ for %%f in (*.ts) do (
bash: syntax error near unexpected token `('
ed@ed-MS-7759 ~/Desktop/jsdtd $ ffmpeg -i "%%f" -c:v h264_nvenc -c:a copy "%%f.mp4"
ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.4)
configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --disable-ffserver --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libtheora --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab --enable-libwavpack --enable-nvenc --enable-libzimg
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
%%f: No such file or directory
ed@ed-MS-7759 ~/Desktop/jsdtd $ )
bash: syntax error near unexpected token `)'
ed@ed-MS-7759 ~/Desktop/jsdtd $
ed@ed-MS-7759 ~/Desktop/jsdtd $ pause
the questions I have:
what does the groupings of %%f (three instances) mean, individually?
do I need to substitute the first %%f with absolute path, in this case /home/ed/Desktop/jsdtd?
is there anything else wrong with the code?
do I need to make a .sh file to use this?
thanks
I am hoping to find something to run in the linux mint terminal that will convert all of the .ts files that it finds to .mp4 in a directory.
while searching google I found this:
------------------------------------------------------------------------
for %%f in (*.ts) do (
ffmpeg -i "%%f" -c:v h264_nvenc -c:a copy "%%f.mp4"
)
pause
------------------------------------------------------------------------
when I ran it in the terminal, I got this:
ed@ed-MS-7759 ~/Desktop/jsdtd $ for %%f in (*.ts) do (
bash: syntax error near unexpected token `('
ed@ed-MS-7759 ~/Desktop/jsdtd $ ffmpeg -i "%%f" -c:v h264_nvenc -c:a copy "%%f.mp4"
ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.4)
configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --disable-ffserver --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libtheora --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab --enable-libwavpack --enable-nvenc --enable-libzimg
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
%%f: No such file or directory
ed@ed-MS-7759 ~/Desktop/jsdtd $ )
bash: syntax error near unexpected token `)'
ed@ed-MS-7759 ~/Desktop/jsdtd $
ed@ed-MS-7759 ~/Desktop/jsdtd $ pause
the questions I have:
what does the groupings of %%f (three instances) mean, individually?
do I need to substitute the first %%f with absolute path, in this case /home/ed/Desktop/jsdtd?
is there anything else wrong with the code?
do I need to make a .sh file to use this?
thanks