VideoHelp Forum
+ Reply to Thread
Results 1 to 11 of 11
Thread
  1. Member ghazalo's Avatar
    Join Date
    Mar 2015
    Location
    Riyadh
    Search PM
    hi all and happy new year

    i am encoding most of my Animation series to 265 high 10 so it reduce the size and almost keep same quality so i hope that i am doing right with the command i'm writing down

    the point is that most of them has soft sub and fonts attached and i do the step as follow

    in windows
    for %i in (*.mkv) do ffmpeg -i %i -pix_fmt yuv420p10le -c:v libx265 -crf 28 -x265-params profile=main10 %~ni.mp4
    then i do in mkvmerge the following
    for %%a in (*.mp4) do ("C:\Program Files\MKVtoolnix\mkvmerge.exe" -o "muxed\%%~na.mp4" --attachment-name "adobe.ttf" --attachment-mime-type application/x-truetype-font --attach-file "D:\project\adobe.ttf" "%%~na.mp4" --language "0:ara" "%%~na.ass")
    it is easy but extracting the sub from the orginal is hard and manual using MKV toolnix extractor
    also when i wanted to do the same in Linux i have no idea what to do or in fact the seedbox may not having mkvmerge so if there is one step in ffmpeg in Linux will be great

    my command in Linux after logging in SSH as follows
    for dir in *.mkv ; do
    ffmpeg -i "$dir" -pix_fmt yuv420p10le -c:v libx265 -crf 28 -x265-params profile=main10 "${dir%.mkv}".mp4;
    done
    can anyone help to transfer the sub and the font in the same step in both Linux and windows (please no hard sub keep soft sub)

    thanks to all in advanced and sorry if this subject repeated

    Regards
    Last edited by ghazalo; 1st Jan 2021 at 15:34.
    Quote Quote  
  2. Try add -map 0 to your ffmpeg command line. That will force ffmpeg to retain other streams. You'll probably have add -c:a copy.
    Quote Quote  
  3. Member ghazalo's Avatar
    Join Date
    Mar 2015
    Location
    Riyadh
    Search PM
    Originally Posted by jagabo View Post
    Try add -map 0 to your ffmpeg command line. That will force ffmpeg to retain other streams. You'll probably have add -c:a copy.
    thanks but in this case will not encode just remux also doesn't take attachment fonts

    or if you show me how to write the command to keep video encoding and copying the other components thanks again

    video info below it may help

    General
    Unique ID : 145499484831826320280273664176079761527 (0x6D762E75049C0DF2508A23D1325BF077)
    Complete name : D:\zzz\01.mkv
    Format : Matroska
    Format version : Version 4
    File size : 1.25 GiB
    Duration : 24 min 12 s
    Overall bit rate : 7 424 kb/s
    Encoded date : UTC 2021-01-02 08:08:35
    Writing application : mkvmerge v45.0.0 ('Heaven in Pennies') 64-bit
    Writing library : libebml v1.3.10 + libmatroska v1.5.2
    Attachments : adobe.ttf

    Video
    ID : 1
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : High@L4
    Format settings : CABAC / 4 Ref Frames
    Format settings, CABAC : Yes
    Format settings, Reference : 4 frames
    Codec ID : V_MPEG4/ISO/AVC
    Duration : 24 min 10 s
    Bit rate : 7 296 kb/s
    Width : 1 920 pixels
    Height : 1 080 pixels
    Display aspect ratio : 16:9
    Frame rate mode : Constant
    Frame rate : 23.976 (24000/1001) FPS
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Bits/(Pixel*Frame) : 0.147
    Stream size : 1.23 GiB (98%)
    Writing library : x264 core 142
    Encoding settings : cabac=1 / ref=4 / deblock=1:1:1 / analyse=0x3:0x113 / me=umh / subme=8 / psy=1 / psy_rd=0.40:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=48 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=48 / rc=crf / mbtree=1 / crf=15.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=8000 / vbv_bufsize=12000 / crf_max=0.0 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:0.60
    Default : Yes
    Forced : No

    Audio
    ID : 2
    Format : AAC LC
    Format/Info : Advanced Audio Codec Low Complexity
    Codec ID : A_AAC-2
    Duration : 24 min 10 s
    Bit rate : 128 kb/s
    Channel(s) : 2 channels
    Channel layout : L R
    Sampling rate : 44.1 kHz
    Frame rate : 43.066 FPS (1024 SPF)
    Compression mode : Lossy
    Delay relative to video : -83 ms
    Stream size : 22.1 MiB (2%)
    Default : Yes
    Forced : No

    Text
    ID : 3
    Format : ASS
    Codec ID : S_TEXT/ASS
    Codec ID/Info : Advanced Sub Station Alpha
    Duration : 23 min 44 s
    Bit rate : 131 b/s
    Count of elements : 283
    Compression mode : Lossless
    Stream size : 22.8 KiB (0%)
    Title : Arabic
    Language : Arabic
    Default : No
    Forced : No
    Last edited by ghazalo; 2nd Jan 2021 at 02:42.
    Quote Quote  
  4. Originally Posted by ghazalo View Post
    thanks but in this case will not encode just remux also doesn't take attachment fonts
    Wrong.
    1. -map 0 will copy the attachments (use .mkv as output file extension/format, not mp4)
    2. he said to use -c:a copy. That will copy the audio. So you set:
    Code:
    -map 0 -c:v libx265 -c:a copy -c:s copy
    (Map all tracks/attachments etc from input, encode video using x265, copy audio and subtitle without further encoding)


    P.S.: Even if you use "-o output.mp4" mkvmerge will still create an mkv file. Mkvmerge will never output mp4 files.
    Quote Quote  
  5. Member ghazalo's Avatar
    Join Date
    Mar 2015
    Location
    Riyadh
    Search PM
    Originally Posted by sneaker View Post
    Originally Posted by ghazalo View Post
    thanks but in this case will not encode just remux also doesn't take attachment fonts
    Wrong.
    1. -map 0 will copy the attachments (use .mkv as output file extension/format, not mp4)
    2. he said to use -c:a copy. That will copy the audio. So you set:
    Code:
    -map 0 -c:v libx265 -c:a copy -c:s copy
    (Map all tracks/attachments etc from input, encode video using x265, copy audio and subtitle without further encoding)
    thank you i will try this command and thanks for clarifying the (a) copy



    Originally Posted by sneaker View Post
    P.S.: Even if you use "-o output.mp4" mkvmerge will still create an mkv file. Mkvmerge will never output mp4 files.
    I have too many times mp4 results from the mkvmerge command just it become mkv if i use GUI but as CMD it stays mp4
    Quote Quote  
  6. Originally Posted by ghazalo View Post
    I have too many times mp4 results from the mkvmerge command just it become mkv if i use GUI but as CMD it stays mp4
    Mkvmerge will never output mp4 files. You have only created mkv files with the wrong filename extension. (I.e. like renaming document.pdf to document.doc in Windows explorer.) Luckily most players don't care about the correct filename extension.
    Quote Quote  
  7. Member ghazalo's Avatar
    Join Date
    Mar 2015
    Location
    Riyadh
    Search PM
    Originally Posted by sneaker View Post
    Mkvmerge will never output mp4 files. You have only created mkv files with the wrong filename extension. (I.e. like renaming document.pdf to document.doc in Windows explorer.) Luckily most players don't care about the correct filename extension.
    aha noted thanks so it appear .mp4 but actually it is .mkv and player just take it because supported both
    Quote Quote  
  8. Member ghazalo's Avatar
    Join Date
    Mar 2015
    Location
    Riyadh
    Search PM
    just for final shape before i go several hours encoding then something went wrong for the whole folder the command will be this correct or wrong?

    for %i in (*.mkv) do ffmpeg -i %i -pix_fmt yuv420p10le -map 0 -c:v libx265 -crf 28 -x265-params profile=main10 -c:a copy -c:s copy -attach D:\zzz\adobe.ttf -metadata:s:3 mimetype=application/x-truetype-font [G]%~ni.mkv
    Last edited by ghazalo; 2nd Jan 2021 at 04:15.
    Quote Quote  
  9. Member ghazalo's Avatar
    Join Date
    Mar 2015
    Location
    Riyadh
    Search PM
    the command above worked

    thanks all
    Quote Quote  
  10. Originally Posted by ghazalo View Post
    -attach D:\zzz\adobe.ttf -metadata:s:3 mimetype=application/x-truetype-font
    If fonts are in the source mkv you don't need to manually extract/attach them. ffmpeg will copy them with -map 0.
    Quote Quote  
  11. Member ghazalo's Avatar
    Join Date
    Mar 2015
    Location
    Riyadh
    Search PM
    Originally Posted by sneaker View Post
    If fonts are in the source mkv you don't need to manually extract/attach them. ffmpeg will copy them with -map 0.
    you are right thanks

    i just tried it now
    Quote Quote  



Similar Threads

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