Hello to all,
Maybe someone could help me.
I want to add ssa subtitles to video.
I've tried with VLC. If I play the video and add subtitles file VLC shows correctly the ssa subtitles but if I convert/save the same video adding the subtitles file, the output doesn't contain the subtitles.
Then I've tried with ffmpeg like this
The output shows the subtitles, but the aspect is changed and the subtitles appear partially or sometimes cutted since the scale is changed and I would like to get the same aspect ratio (16:9) and same width x height as input video. Or even better reduce video size with same aspect ratioCode:ffmpeg -i video.mp4 -vf "ass=subtitle.ass" -strict -2 out.mp4
How can I do that with ffmpeg, VLC or another open source tool?
I can share this log:
Then I tried to in [Script Info] section within subtitle.ass below lines but it didn't help.Code:user@H:/mnt/d/VIDEOS$ ffmpeg -i input.mp4 -vf ass=subtitles.ass -v 40 -strict -2 out.mp4 ffmpeg version 2.8.14-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609 configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv libavutil 54. 31.100 / 54. 31.100 libavcodec 56. 60.100 / 56. 60.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 40.101 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100 Routing option strict to both codec and muxer layer Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf56.40.101 Duration: 00:04:06.06, start: 0.000000, bitrate: 450 kb/s Stream #0:0(und): Video: h264 (Main), 3 reference frames (avc1 / 0x31637661), yuv420p(tv, bt709), 854x480 (864x480) [SAR 1:1 DAR 427:240], 314 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default) Metadata: handler_name : SoundHandler [Parsed_ass_0 @ 0x7f7880] Raster: FreeType 2.6.1 [Parsed_ass_0 @ 0x7f7880] Shaper: FriBidi 0.19.7 (SIMPLE) HarfBuzz-ng 1.0.1 (COMPLEX) [Parsed_ass_0 @ 0x7f7880] Initialized [Parsed_ass_0 @ 0x7f7880] Using font provider fontconfig [Parsed_ass_0 @ 0x7f7880] File size: 3368 [Parsed_ass_0 @ 0x7f7880] [0x826cb0] Style: Default,Goudy Old Style,22,&H002DD8DB,&H000000FF,&H00000000,&H00000000,-1,0,0,0,100,100,0,0,1,2,2,2,10,10,10,1 [Parsed_ass_0 @ 0x7f7880] Added subtitle file: 'subtitles.ass' (2 styles, 27 events) [graph 0 input from stream 0:0 @ 0x8ed880] w:854 h:480 pixfmt:yuv420p tb:1/30000 fr:30000/1001 sar:1/1 sws_param:flags=2[graph 1 input from stream 0:1 @ 0x8f2ee0] tb:1/44100 samplefmt:fltp samplerate:44100 chlayout:0x3 [libx264 @ 0x82bd00] using SAR=1/1 [libx264 @ 0x82bd00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2 [libx264 @ 0x82bd00] profile High, level 3.1 [libx264 @ 0x82bd00] 264 - core 148 r2643 5c65704 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00: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=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'out.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf56.40.101 Stream #0:0(und): Video: h264 (libx264), -1 reference frame ([33][0][0][0] / 0x0021), yuv420p, 854x480 [SAR 1:1 DAR 427:240], q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc (default) Metadata: handler_name : VideoHandler encoder : Lavc56.60.100 libx264 Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 128 kb/s (default) Metadata: handler_name : SoundHandler encoder : Lavc56.60.100 aac Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:1 -> #0:1 (aac (native) -> aac (native)) Press [q] to stop, [?] for help [Parsed_ass_0 @ 0x7f7880] Neither PlayResX nor PlayResY defined. Assuming 384x288 [Parsed_ass_0 @ 0x7f7880] fontselect: (Goudy Old Style, 700, 0) -> /usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf, 0, DejaVuSans-Bold No more output streams to write to, finishing.e=00:04:05.22 bitrate= 562.3kbits/s frame= 7373 fps=142 q=-1.0 Lsize= 17301kB time=00:04:06.06 bitrate= 576.0kbits/s video:13086kB audio:3963kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.480544% Input file #0 (input.mp4): Input stream #0:0 (video): 7373 packets read (9668740 bytes); 7373 frames decoded; Input stream #0:1 (audio): 10597 packets read (3937072 bytes); 10597 frames decoded (10851328 samples); Total: 17970 packets (13605812 bytes) demuxed Output file #0 (out.mp4): Output stream #0:0 (video): 7373 frames encoded; 7373 packets muxed (13399929 bytes); Output stream #0:1 (audio): 10597 frames encoded (10851328 samples); 10598 packets muxed (4058185 bytes); Total: 17971 packets (17458114 bytes) muxed [libx264 @ 0x82bd00] frame I:38 Avg QP:16.75 size: 22811 [libx264 @ 0x82bd00] frame P:3026 Avg QP:22.01 size: 3818 [libx264 @ 0x82bd00] frame B:4309 Avg QP:24.78 size: 227 [libx264 @ 0x82bd00] consecutive B-frames: 20.0% 5.0% 3.4% 71.6% [libx264 @ 0x82bd00] mb I I16..4: 34.7% 50.6% 14.7% [libx264 @ 0x82bd00] mb P I16..4: 1.8% 3.4% 0.2% P16..4: 24.0% 6.6% 5.1% 0.0% 0.0% skip:59.0% [libx264 @ 0x82bd00] mb B I16..4: 0.1% 0.1% 0.0% B16..8: 14.3% 0.1% 0.0% direct: 0.3% skip:85.0% L0:39.0% L1:59.1% BI: 1.9% [libx264 @ 0x82bd00] 8x8 transform intra:60.3% inter:53.1% [libx264 @ 0x82bd00] coded y,uvDC,uvAC intra: 23.0% 35.3% 6.9% inter: 5.4% 5.7% 0.4% [libx264 @ 0x82bd00] i16 v,h,dc,p: 47% 22% 13% 18% [libx264 @ 0x82bd00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 16% 34% 2% 2% 2% 2% 2% 2% [libx264 @ 0x82bd00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 20% 11% 5% 8% 7% 7% 6% 6% [libx264 @ 0x82bd00] i8c dc,h,v,p: 61% 16% 20% 4% [libx264 @ 0x82bd00] Weighted P-Frames: Y:17.8% UV:16.1% [libx264 @ 0x82bd00] ref P L0: 70.2% 11.5% 13.4% 4.9% 0.0% [libx264 @ 0x82bd00] ref B L0: 91.9% 7.0% 1.1% [libx264 @ 0x82bd00] ref B L1: 96.6% 3.4% [libx264 @ 0x82bd00] kb/s:435.73
Thanks in advanceCode:PlayResX: 854 PlayResY: 480
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 7 of 7
Thread
-
-
Strange. All is SAR 1:1 so I wouldn't expect any difficulties. Try:
Code:PlayResX: 720 PlayResY: 480
Code:PlayResX: 1920 PlayResY: 1080
Code:PlayResX: 1280 PlayResY: 720
-
Hello sneaker,
Trying the 3 ways you suggested I got the following error:
Code:I got this error [Parsed_ass_0 @ 0x16ad880] Shaper: FriBidi 0.19.7 (SIMPLE) HarfBuzz-ng 1.0.1 (COMPLEX) [Parsed_ass_0 @ 0x16ad880] Using font provider fontconfig [Parsed_ass_0 @ 0x16ad880] ass_read_file(subtitle.ass): fopen failed [Parsed_ass_0 @ 0x16ad880] Could not create a libass track when reading file 'subtitle.ass' [AVFilterGraph @ 0x16ae920] Error initializing filter 'ass' with args 'subtitle.ass' Error opening filters!
-
It was a typo in subtitle file. Now I was able to try the 3 resolutions you suggested.
For the first 720x480 the text appears I think with correct size, but with wrong position.
For the other 2 resolutions the text size looks very small and the same for the position, is wrong.
I donīt know if some previous step is needed like demux the subtitles in a mp4 stream and then mix with the input. I donīt have more ideas.
I.ve tried with XMecia Recode too and Iīm not sure if Iīm doing something wrong but the subtitles donīt appear in output.
Thanks for help so far -
Similar Threads
-
How to add own, subtitles (resp. pure text) into existing MP4 video?
By pxstein in forum SubtitleReplies: 4Last Post: 22nd Dec 2018, 15:18 -
Add 2nd/additional/multiple subtitles to MP4
By Budman1 in forum SubtitleReplies: 0Last Post: 23rd Nov 2015, 14:08 -
How to add Sup subtitles to MP4 File?
By Shlomi in forum SubtitleReplies: 12Last Post: 28th Jul 2015, 23:22 -
Fastest method to add .ass (ssa, aegisub) SubStationAlpha subs to mp4?
By mateuszn0 in forum SubtitleReplies: 2Last Post: 18th Dec 2014, 14:51 -
Embedding .ass subtitles to mp4 files
By MMFG in forum SubtitleReplies: 5Last Post: 2nd Oct 2014, 01:46