VideoHelp Forum
+ Reply to Thread
Results 1 to 8 of 8
Thread
  1. 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
    Quote Quote  
  2. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Try add

    Code:
    -c:s copy
    http://ffmpeg.org/ffmpeg.html#Main-options

    And you need a newer ffmpeg that supports the -c command.


    And please don't cross post. I removed your other thread.
    Quote Quote  
  3. 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
    Quote Quote  
  4. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    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.
    Quote Quote  
  5. 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
    done
    Last edited by coquex; 26th Aug 2013 at 15:26.
    Quote Quote  
  6. 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
    ffmpeg version 1.0.7 Copyright (c) 2000-2013 the FFmpeg developers
    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?
    Quote Quote  
  7. 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
    Now I need if some of you know how to make a script for linux to automatically batch files.

    Thank you.
    Quote Quote  
  8. Member
    Join Date
    Jun 2016
    Location
    india
    Search Comp PM
    for batch converting all files in folder this command might be useful just added some modification for the existing command it might work
    ffmpeg for f in *.mkv;do ffmpeg -i "$f" -vcodec copy -acodec copy -c copy "${f%mkv}mp4";done
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!