Hello people, this is my first post and I hope you can help me with a little thing.
So I have a lot of MKV files in a remote server (I have access only using SSH).
The server is a linux server so I canīt run any .bat or stuff like that.
I need to convert my library using ffmpeg (not other software) from MKV to MP4, I mean, not converting just Remuxing.
The MKV files have 3 tracks, video, audio and subtitle and I have to maintain all of them in the new MP4 file.
The MKV files have spaces for example: my video 2000.mkv .
I only made a conversion from a simple line of code like this:
ffmpeg -i old_video.mkv -vcodec copy -acodec copy new_video.mp4
But the output file have no subtitles at all.
All the MKV have a subtitle inside but I have a srt file too of all my files in case I have to mux the set again so this is not a porblem if someone know how to mux with an external srt.
Can someone help me to have a correct script to run and Mux all my library?
Thank you very much.
Coquex
+ Reply to Thread
Results 1 to 8 of 8
-
-
Try add
Code:-c:s copy
And you need a newer ffmpeg that supports the -c command.
And please don't cross post. I removed your other thread. -
Hi Baldrick,
Can you please be a little more specific because there is a emoticon in the middle of your message.
How can be the line looks like?
Any idea on hoy to build a script for this?
Thank you -
I have updated the post already.
I haven't done any much batch scripting in linux. But I'm pretty sure you will find lots of sample of you google. -
Yes, sorry for that double post, I was a little lost when I tried to make this thread.
I canīt find any batch script in google yet. I was looking for 4 hours and 0 results, I mean, I donīt have any scripting experience so thats is so hard to me to make this work.
Can you put that command in the line Iīm using because I only have 5 hours experience using ffmpeg.
Thank you.
EDIT: This was the script I used to convert from MP4 to MKV using mkvtoolnix. Maybe this can make some of you a adaptation to my new requirements.
FILES=*.mp4
for fullfile in $FILES
do
f=$(basename "$fullfile")
echo "Processing $f file..."
if [ -e "$f.mkv" ]; then
echo "$f.mkv ya existe"
else
~/bin/mkvmerge -o "${f%.*mp4}.mkv" -S "$f" --sub-charset 0:UTF8 -s 0 -D -A "${f%.*mp4}.srt"
fi
doneLast edited by coquex; 26th Aug 2013 at 14:26.
-
Sorry for the double post but I used the line with -c
copy and this was the result.
Code:ffmpeg -i Idle.mkv -vcodec copy -acodec copy -c:s copy new_video.mp4
built on Jul 6 2013 00:16:59 with gcc 4.5.3 (Gentoo 4.5.3-r2 p1.5, pie-0.4.7)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-O2 -pipe' --extra-cflags='-O2 -pipe' --extra-cxxflags='-O2 -pipe' --disable-static --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --disable-stripping --disable-debug --disable-doc --disable-network --disable-vaapi --disable-vdpau --disable-ffplay --disable-runtime-cpudetect --enable-libx264 --enable-libfaac --enable-nonfree --disable-indev=v4l2 --disable-indev=alsa --disable-indev=oss --disable-indev=jack --disable-outdev=alsa --disable-outdev=oss --disable-outdev=sdl --enable-librtmp --disable-amd3dnow --disable-amd3dnowext --disable-altivec --disable-avx --disable-mmxext --disable-ssse3 --disable-vis --disable-neon --enable-hardcoded-tables
libavutil 51. 73.101 / 51. 73.101
libavcodec 54. 59.100 / 54. 59.100
libavformat 54. 29.104 / 54. 29.104
libavdevice 54. 2.101 / 54. 2.101
libavfilter 3. 17.100 / 3. 17.100
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
Input #0, matroska,webm, from 'Idle.mkv':
Metadata:
creation_time : 2013-08-21 17:10:57
Duration: 01:32:04.54, start: 0.000000, bitrate: 1134 kb/s
Stream #0:0: Video: h264 (High), yuv420p, 1280x696 [SAR 1:1 DAR 160:87], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
Stream #0:1(eng): Audio: aac, 48000 Hz, stereo, s16 (default)
Stream #0:2: Subtitle: subrip (default)
[mp4 @ 0x6b7b60] track 2: could not find tag, codec not currently supported in container
Output #0, mp4, to 'new_video.mp4':
Metadata:
encoder : Lavf54.29.104
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x696 [SAR 1:1 DAR 160:87], q=2-31, 23.98 fps, 1k tbn, 1k tbc (default)
Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo (default)
Stream #0:2: Subtitle: subrip (default)
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Stream #0:2 -> #0:2 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): Operation not permitted
Any help? -
I made it, itīs now working.
Sorry about the triple post!
This was the correct line to remux from mkv to mp4 in case someone needs it in the future:
Code:ffmpeg -i old_video.mkv -vcodec copy -acodec copy -c:s mov_text new_video.mp4
Thank you.
Similar Threads
-
Batch method to convert subtitles embedded in mkv's
By invinciblegod in forum SubtitleReplies: 4Last Post: 9th Aug 2012, 01:11 -
Batch mux flv to mkv?
By Pitorasilo in forum Video ConversionReplies: 13Last Post: 14th Apr 2012, 04:25 -
All-in-one Batch demux FLV -> mux mp4?
By gaikokujinkyofusho in forum Video ConversionReplies: 2Last Post: 19th Jan 2011, 23:34 -
Not sure if it goes here. Convert MP4 and MKV to DVD with subtitles.
By The_Forastero in forum Video ConversionReplies: 2Last Post: 15th Jun 2010, 13:33