I have been trying to merge 5 videos and hardcode subtitles across the merged result with one emcode. So far I have been experimenting with:
This allows subtitles for each separate merged file but the subtitles in subtitles1.ass must be notated as time+video0. While this may be OK for say 2 files, keeping the times aligned after 3,4 5 videos merged is difficult to say the least. I tried overlapping the ASS times as 00:00:06,000 --> 00:00:10,000 and 00:12:00,000 --> 00:12:10,000 for 2 10 minute merged videos but 12 minute sub that should have appear around 2 minutes into the second merged video does not show up.Code:ffmpeg -i xInstagram.mp4 -i xInstagram.mp4 -filter_complex "[0:v]ass=subtitles.ass[video0];[1:v]ass=subtitles1.ass[video1];[video0][video1]concat=n=2[out]" -map [out] -preset ultrafast -y final.mp4
I guess what I really need is to know if it possible at all and maybe a script using ffmpeg that I can begin altering as needed.
Thank You
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
-
-
If the subtitles are already included in the individual video parts, you can try to join these parts with type instead of ffmpeg.
Open a command prompt executing cmd; then insert:
type "Full path\file1.mp4 Full path\file2.mp4 Full path\file3.mp4" > "Full path\output.mp4" -
No subtitles are not already hardcoded. I am trying to merge 5 videos without subtitles and hardcode subtitles that would take in all the merged videos. I have 5 x 10 second videos and I want to merge them for 0-50 seconds and encode subtitles that span the 50 seconds. I can do this in 2 processes but that is extra encoding if I can do it in one. Maybe it is not possible but thought I'd ask those who have more knowledge of complex filter graphs. I almost understand them when I see an example but have trouble creating one that works. . Lol
-
Merging isn't encoding, so there is no quality loss. The second pass (hardcoding subtitle) must be done anyway.
-
yes I think I understand. My goal was to have as few re-encoding as possible.
After experimenting a lot, I realized that what I was trying to do and what I explained may not have been the same. I am actually trying to find a method that Merges and adds subtitles without making an intermediate file (Merged file). That way it can be previewed before any coding or extra files are created.
I think I have found a way to do that using avisynth to decode and then join the files and then have FFMpeg encode it once to a single final file with the subtitles added or preview it by piping it to ffplay or another viewer. I am assuming Avisynth uses a decoder to view/join/cut/etc. but does not actually re-encode. I know ffmpeg will re-code the composite video when the MP4 file is created from the avisynth file but since it is part of the same operation, re-encoding and quality loss should only occur once.
Or maybe I have no idea if that is correct. LOL
I'm hoping that the logic is correct.
Thank You ProWo for your response and information. -
Shouldn't you just have to change the filter order, i.e. first concat and then render the subtitles?
Something like:
Code:-filter_complex "[0:v][1:v]concat=n=2[appended];[appended]ass=subtitles.ass[out]" -map [out]
-
Sneaker.. That is beautiful and I even understand it. LOL
The reason I needed this is because I have written a program that allows cutting anywhere and just Encoding from the cut point to the next key frame. For that function it works pretty well (Still work in progress) I need to encode with the same or compatible settings so the cut segments join without a hiccup at the joining point.
I have been using SRT subtitles and do not know if ass=xxx.ass will work with SRT. Its not a big thing as I can switch to ASS subtitles in my program. I also added various editing functions as well as stack and subtitles. Most of these are easily achieved during the encoding phase. Merging and the encoding took 2 steps and was very hard to preview for this reason.
I have been using below for SRT subtitles but with your excellent example I can preview the merge, alterations and and subtitles more easily:
Code:ffmpeg -i Joined.cvs -t 154.939266 -vf eq=1.00:0.00:1.00:1.0:1.00:1.00:1.00:1.0,crop=854:280:0:100,"subtitles='C\:\\Users\\Bud\\Desktop\\TrimNMerge\\TrimNMerge\\bin\\Debug\\work\\Subtitles.srt':force_style='FontName=Arial,PrimaryColour=&H00FFFFFF,BackColour=&H00000000,BorderStyle=4,Outline=1,Shadow=0,MarginV=20,Fontsize=24,Alignment=1'",scale=854:480,pad=854:480:(ow-iw)/2:(oh-ih)/2,setsar=1 -x264-params ref=1:me=hex:subme=7:psy=1:mixed-refs=1:me-range=16:chroma-me=1:trellis=1:8x8dct=1:cqpfile=0:fast-pskip=1:chroma-qp-offset=-2:threads=12:lookahead-threads=10:sliced-threads=0:nr=0:interlaced=0:bluray-compat=0:constrained-intra=0:bframes=3:b-pyramid=1:b-adapt=1:b-bias=0:direct=3:weightb=1:keyint=25:min-keyint=25:scenecut=40:intra-refresh=0:rc-lookahead=40:mbtree=1:crf=20.0:qcomp=0.60:qpmin=0:qpmax=69:qpstep=4 -af "adelay=0|0,apad=whole_dur=5.006" -vcodec libx264 -crf 20 -b:v 400k -bufsize:v 400K -r 29.97 -acodec aac -ac 2 -ab 64400 -ar 48000 -max_muxing_queue_size 9999 -y "D:\PathToVideo\Subbed Joined.MP4"
Thank You all for your help.
Similar Threads
-
How to extract subtitle from stream site
By ningnong132 in forum SubtitleReplies: 2Last Post: 7th Jan 2017, 06:45 -
How to stream videos and record them directly from TV
By lucky113 in forum Video Streaming DownloadingReplies: 7Last Post: 25th Sep 2016, 21:13 -
NOT FINDING SUBTITLE STREAM: with DVDFAB and TSMUXER
By rodrigo_levy in forum Blu-ray RippingReplies: 0Last Post: 4th Jul 2016, 10:30 -
Hi
By spyro10 in forum Video Streaming DownloadingReplies: 1Last Post: 25th May 2016, 16:23