VideoHelp Forum




+ Reply to Thread
Results 1 to 3 of 3
  1. Hi, I'm running Ubuntu 11.04 and I have ffmpeg compiled and installed.

    I have some MKV's with .ass subs (with embedded fonts) and I need to convert them to mp4. I'd prefer to do it in ffmpeg because I know the syntax well... anyway...

    I want to hardsub the mp4s, so I want to know what would be the best way to do that through Ubuntu 11.04 and ffmpeg is and what other programs I'll need to do it.
    Quote Quote  
  2. Mrs Intel Core i7's Avatar
    Join Date
    Mar 2011
    Location
    Mainland E.U, concierge
    Search Comp PM
    I wasn`t able to make f-mpeg to run. Can`t reply
    Quote Quote  
  3. Member
    Join Date
    Mar 2012
    Location
    Australia
    Search Comp PM
    Recently found out how to get this to work.

    ffmpeg often doesn't have libass support built in by default. I had to rebuild ffmpeg. You can check whether you need to do this by invoking ffmpeg with no arguments. It should print the list of configure args used when compiling. If --enable-libass isn't there, you probably need to rebuild. Arguments listed at the end of this post.

    mkvextract (part of mkvtoolnix) is needed to extract the subtitle files. Unfortunately ffmpeg doesn't seem to be able to handle internal subtitle and font files directly in this context, it can only accept an external file.

    Here are the scripts I use to encode every mkv in the present directory to hardsubbed mp4 for playing on the PS3:

    file: extract_subs.sh
    Code:
    #!/bin/bash
    for i in *.mkv
    do
       mkvextract tracks "${i}" 2:"${i}".ass
    done
    file: encode_all.sh
    Code:
    #!/bin/bash
    for i in *.mkv
    do
       ffmpeg -i "${i}" -sn -c:v libx264 -x264opts crf=20 -filter ass="${i}".ass -c:a aac -strict experimental "${i}".mp4
    done
    The "-strict experimental" is currently needed for aac audio encoding, apparently.

    The extract_subs script assumes that the subtitle stream is the third one (labelled 2, counting from 0). If you find a set of files with the subtitle stream first (use mkvinfo to check) then the mkvextract command would be like this:

    mkvextract tracks "${i}" 0:"${i}".ass

    Here is the complete set of configure args used when building my ffmpeg (note --enable-libass):

    ./configure \
    --prefix=/usr \
    --enable-gpl \
    --enable-libfaac \
    --enable-libmp3lame \
    --enable-libtheora \
    --enable-libvorbis \
    --enable-libx264 \
    --enable-nonfree \
    --enable-x11grab \
    --enable-shared \
    --enable-libass \
    --enable-libxvid \
    --enable-libvpx \
    --enable-libgsm \
    --enable-libspeex \
    --enable-x11grab \
    --enable-libopencore_amrnb \
    --enable-libopencore_amrwb \
    --enable-libschroedinger \
    --enable-libopenjpeg \
    --enable-librtmp \
    --enable-libpulse \
    --enable-version3 \
    --enable-runtime-cpudetect \
    --disable-debug --disable-static
    Quote Quote  



Similar Threads

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