-1

The manual it should support mkv files with: Video: H.264 /AVC, XViD, MPEG-4 Part2 Audio: HE-AAC, Dolby Digital, MPEG-1 Layer III (MP3) Support .ass subtitles too. So what should i exactly do to be able to play this with the correct formatting and everything else?

Converted the FLAC audio to AAC using this command:

ffmpeg -i CodeGeass01.mkv -c:a libfdk_aac -profile:a aac_he_v2 CodeGeass01_1.mkv

It plays, but without the custom fonts and the subtitle positioning not working either. So it seems i need to make a hardsub video, need to burn in the subtitles. and encode the audio to aac. so how do i exactly do that, with the correct formatting, positioning etc?

Output of ffmpeg -i CodeGeass01.mkv:

ffmpeg version 4.3.2-0+deb11u1ubuntu1 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10 (Ubuntu 10.2.1-20ubuntu1)
  configuration: --prefix=/usr --extra-version=0+deb11u1ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=0+deb11u1ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libaribb24 --enable-liblensfun --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
[matroska,webm @ 0x561477f71200] Could not find codec parameters for stream 3 (Attachment: none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[matroska,webm @ 0x561477f71200] Could not find codec parameters for stream 4 (Attachment: none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[matroska,webm @ 0x561477f71200] Could not find codec parameters for stream 5 (Attachment: none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[matroska,webm @ 0x561477f71200] Could not find codec parameters for stream 6 (Attachment: none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[matroska,webm @ 0x561477f71200] Could not find codec parameters for stream 7 (Attachment: none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[matroska,webm @ 0x561477f71200] Could not find codec parameters for stream 8 (Attachment: none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[matroska,webm @ 0x561477f71200] Could not find codec parameters for stream 9 (Attachment: none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[matroska,webm @ 0x561477f71200] Could not find codec parameters for stream 10 (Attachment: none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, matroska,webm, from '[ShadyCrab] Code Geass Lelouch of the Rebellion - S01E01v2 [BD][1080p][Hi10][Dual][8F912937] (1).mkv':
  Metadata:
    encoder         : libebml v1.4.2 + libmatroska v1.6.4
    creation_time   : 2021-10-11T22:08:26.000000Z
  Duration: 00:24:10.45, start: 0.000000, bitrate: 6340 kb/s
    Chapter #0:0: start 0.000000, end 104.104000
    Metadata:
      title           : Chapter 01
    Chapter #0:1: start 104.104000, end 194.194000
    Metadata:
      title           : Chapter 02
    Chapter #0:2: start 194.194000, end 793.793000
    Metadata:
      title           : Chapter 03
    Chapter #0:3: start 793.793000, end 1359.358000
    Metadata:
      title           : Chapter 04
    Chapter #0:4: start 1359.358000, end 1450.449000
    Metadata:
      title           : Chapter 05
    Stream #0:0(jpn): Video: h264 (High 10), yuv420p10le(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Metadata:
      BPS             : 5597190
      DURATION        : 00:24:10.449000000
      NUMBER_OF_FRAMES: 34776
      NUMBER_OF_BYTES : 1014804966
      _STATISTICS_WRITING_APP: mkvmerge v62.0.0 ('Apollo') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2021-10-11 22:08:26
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(jpn): Audio: flac, 48000 Hz, stereo, s16 (default)
    Metadata:
      BPS             : 735933
      DURATION        : 00:24:10.449000000
      NUMBER_OF_FRAMES: 16998
      NUMBER_OF_BYTES : 133429238
      _STATISTICS_WRITING_APP: mkvmerge v62.0.0 ('Apollo') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2021-10-11 22:08:26
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:2: Subtitle: ass (default)
    Metadata:
      BPS             : 158
      DURATION        : 00:23:31.690000000
      NUMBER_OF_FRAMES: 470
      NUMBER_OF_BYTES : 27973
      _STATISTICS_WRITING_APP: mkvmerge v62.0.0 ('Apollo') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2021-10-11 22:08:26
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:3: Attachment: none
    Metadata:
      filename        : AbbeyHU.ttf
      mimetype        : font/ttf
    Stream #0:4: Attachment: none
    Metadata:
      filename        : Formal421N.ttf
      mimetype        : font/ttf
    Stream #0:5: Attachment: none
    Metadata:
      filename        : ARIBLK_0.TTF
      mimetype        : font/ttf
    Stream #0:6: Attachment: none
    Metadata:
      filename        : INSULA__.ttf
      mimetype        : font/ttf
    Stream #0:7: Attachment: none
    Metadata:
      filename        : BOOKOSI.TTF
      mimetype        : font/ttf
    Stream #0:8: Attachment: none
    Metadata:
      filename        : BOOKOSBI.TTF
      mimetype        : font/ttf
    Stream #0:9: Attachment: none
    Metadata:
      filename        : BOOKOSB.TTF
      mimetype        : font/ttf
    Stream #0:10: Attachment: none
    Metadata:
      filename        : H_DEVTBI.TTF
      mimetype        : font/ttf
llogan
  • 121,796
  • 28
  • 232
  • 243

1 Answers1

-1

so it seems i need to make a hardsub video, need to burn in the subtitles. and encode the audio to aac. so how do i exactly do that, with the correct formatting, positioning etc?

Use the subtitles filter:

ffmpeg -i input.mkv -vf "subtitles=input.mkv" output.mp4
  • You can make a short test by adding the -t option, such as -t 60 for an output limited to 60 seconds.

  • If the fonts are not rendered in the correct typeface then you may have to:

    1. Dump all of the font files with -dump_attachment:

      ffmpeg -dump_attachment:t "" -i INPUT
      
    2. Then use the fontsdir option in the subtitles filter, or install the fonts to your system.

llogan
  • 121,796
  • 28
  • 232
  • 243
  • movenc supports ttml since Aug 25: https://github.com/FFmpeg/FFmpeg/commit/e41bd075dd – Gyan Oct 13 '21 at 04:10
  • Thanks for the detailed answer. These are not my videos or subtitles i just downloaded them from different sites. I want to convert it to mp4 to see how it plays on my older televesion. It not supporting mkv format but supports mp4 thats why i want to convert it and preserve the formatting etc. if possible. still a begginer with this. – Norbert Nagy Oct 13 '21 at 20:22
  • I probaly need to convert the audio to aac either way – Norbert Nagy Oct 13 '21 at 20:41
  • Okay after checking the manual it should support mkv files with: Video: H.264 /AVC, XViD, MPEG-4 Part2 Audio: HE-AAC, Dolby Digital, MPEG-1 Layer III (MP3) Support .ass subtitles too. So what should i exactly do to be able to play this with the correct forrmatting and everything else? – Norbert Nagy Oct 13 '21 at 20:57
  • Oh wait it says it support .ass and some more ass external subtiles and XSUB(supports DivX6 generated internal subtitles) as internal subtitle. Hmm. I still want to try maybe it will play just fine. – Norbert Nagy Oct 13 '21 at 21:06
  • It says subtitle and video named the same to be able to play them both automatically, there is no option to select subtitles when im playing a video. Maybe if i try this it hopefully plays and everything will appear correctly. – Norbert Nagy Oct 13 '21 at 21:17
  • I goo to sleep, i will come back sometime tommorow. – Norbert Nagy Oct 13 '21 at 21:26
  • so here is what i did: compilled ffmpeg from source with libfdk-aac beacuse its not supported in the regular package. – Norbert Nagy Oct 14 '21 at 17:35
  • coverted the audio using this command: "ffmpeg -i CodeGeass01.mkv -c:a libfdk_aac -profile:a aac_he_v2 CodeGeass01_1.mkv" – Norbert Nagy Oct 14 '21 at 17:38
  • here is the output: [link](https://pastebin.com/A6nWvjQf) for some reson it reconverted the video too so it took a lot of time. – Norbert Nagy Oct 14 '21 at 17:42
  • maked a new directory on the pendrive an moved the video and the subtitle there with the same name. it plays, but without the custom fonts and the subtitle positioning not working either. – Norbert Nagy Oct 14 '21 at 17:47
  • so it seems i need to make a hardsub video, need to burn in the subtitles. and encode the audio to aac. so how do i exactly do that, with the correct formatting, positioning etc? i think this is my final question sorry for writing so much. – Norbert Nagy Oct 14 '21 at 17:51
  • @llogan ....... – Norbert Nagy Oct 14 '21 at 17:52
  • @NorbertNagy You forgot to map the fonts. Default [stream selection](https://ffmpeg.org/ffmpeg.html#Stream-selection) only picks 1 stream per stream type. So tell it to map everything: `ffmpeg -i input.mkv -map 0 -c copy -c:a aac output.mkv`. If TV doesn't like it see updated answer above for hardsubs. Don't bother with separate ASS file: that suggestion was only for computer based players, specifically for VLC or mpv. I have no idea if TVs follow such convention. – llogan Oct 14 '21 at 18:38
  • Thanks. It seems my tv dont know subtitle positioning the subtitles appear (f/300 "the content of the subtitle") or something like this so i definitely need to go with hardsubs. – Norbert Nagy Oct 16 '21 at 15:32