[0:00] Hello this is Stef! Welcome back to  my channel so I remind you to like   [0:04] share and subscribe if you like  the content that I'm providing.   [0:08] Now, today we're going to see something a  bit different. So far we dealt with videos,   [0:14] we dealt with what to do with images we dealt  with what to do with videos we did a lot with   [0:19] the video track we are going to see another type  of track that is the subtitle track we're going   [0:25] to see how to extract subtitles how to burn  subtitles how to manage subtitles in general [0:33] hmm okay [0:38] I see and how to manipulate them in order to  include them in the file you want So at the   [0:45] moment I have a subunitu already behind  me and so now it's time to get started [0:58] okay we here we have zuboon 2 ready and the video  we're analyzing at this moment is a video called   [1:05] singtel sintel is made by the same house let's  say that did that made a Big Buck Bunny so a   [1:15] video that we already seen that we already know  this is a video that if you watch it is not as   [1:22] a light themed as a big bug bunny there's a bit  more dense plot and it's a bit moving so I cried   [1:32] a little as soon as I watched this movie anyway  it's remarkable for us because if we take a look   [1:37] using FF probe so now let's let's meet go to the  right folder so here we have the latest version   [1:47] that we have so far we are trying to invoke FF  Probe on this video and we'll see what is going on   [1:57] what are the tracks that are available right here  okay as the local program you see that there is   [2:06] um so it's quite complex it's quite well done as  a video something that we might expect out of a   [2:13] movie for example and here we see that there is a  video input with the chapters but the the concept   [2:24] of the chapters is going to be seen another  video um we have an audio track and a lot of   [2:34] subtitle tracks so here if you would like we can  also invoke a probe to take the streams so let's   [2:45] see what it tells so I have a probe minus show  streams and also let's see show format as well [2:57] this way yeah plane way and you see that right  here we have all the indications of all the   [3:06] streams you have all the indications we see that  the type of codec is a subrip and so let's have   [3:13] a look at what we can do so first of all let's  have a look also at the available subtitles codex   [3:20] so even the subtitles have their own codecs so  seems strange but it is like this so to inspect   [3:28] which are the um the tracks available sorry  the types of subtitles available you can go   [3:36] and take a FM pack minus codex then we put a pipe  with a research upon this track so we can take [3:50] there's a string of research so it's  going to take what's in the beginning   [3:56] uh in the beginning you saw the indication if  it is uh which type of codec which so in this   [4:04] case we want a subtitle track as this available  and again I always forget to book it locally   [4:15] and here as you can see this is all the list  of types of subtitles that we can use within   [4:23] our videos here we go uh among them there  is a sub rip so subrip subtitles and so we   [4:33] can use it directly another way of taking out  the subtitles out of your file is to invoke   [4:42] admin pack minus codex and again a pipe grab  subtitle simple as that again local invocation   [4:55] and here you have all the lists as before so  the same list can be wrapped in this way maybe   [5:01] this is easier the other is a bit more hacky  with the the grab and stuff if you would like   [5:08] to extract the subtitles out of the video what  we can do is to invoke headphone package again   [5:16] minus I name of the video so now we take as the  input the input file and what we want is only   [5:26] the subtitle track so to invoke the subtitle  track what we're going to do is to remove   [5:34] the video track so minus the end remove the audio  tracks okay and among the subtitle tracks we're   [5:44] going to use for example the first so in this  case what you have to do is to take the math   [5:52] then got to take the first file and we're going  to select the first subtitle track that if I'm not   [6:04] wrong it was the German one so what I'm going  to do now I'm going to take the type of codec   [6:11] in this case a minus C colon s s stands for  subtitle that is available both in the map and in   [6:23] the codec here we're going to copy  we want the track as it is and then [6:32] what we can say is take as output file a file  that has the German language dot the native   [6:44] format for the subtitle stream subrip as it is  available in the video is SRT let's see it works   [6:57] and here what it does is extracting all  the subtitles that are out in the video   [7:05] here we go the type is a copy so they should  be as they are within the video now let's see   [7:12] what's the content of this video this is  a plain readable file differently from the   [7:19] video and the audio usually the audio  in the video are binary requires some   [7:23] special treatment for the subtitles this is  quite easy let's have a look as a subtitled   [7:29] we can open it directly using a text editor  so we're going to use a VIN and let's take a [7:40] video and here we see all the results here you  see the syntax that is inside our video inside our   [7:51] subtitles so you see that there's a progressive  number for each subtitles you would like to take   [7:58] you see the instant you want to show the subtitle  minus minus greater than sine so just a remarkable   [8:08] there is a text way to Mark um an arrow and  then the end of showing of your subtitle so   [8:19] beginning and so the certain the some subtraction  of the last and the first value is the duration of   [8:27] your uh of your subtitle and here you have your  text here the text if you want you can put it in   [8:37] multiple lines here this is put in two lines so  here you have the first line and the second line   [8:43] simply then all the entries must be separated  by align the middle so it is as simple as that   [8:52] if you would like you can type in manually there  are some programs that you would like to use it   [9:00] um you would like to use to make them better but  this is all that you need to know to deal with the   [9:06] subtitles okay so we dealt with the SRT subtitles  the subgrade Oma subtitles if you would like to   [9:14] use other types of subtitles you can so we saw the  list also titles that you can use for example if   [9:21] you would like to use that dot ass subtitles what  you can do is to convert the subtitles as well so [9:32] you can use the input also so subtitle as input  as well and we can change it to the same name   [9:45] and in this case instead of putting SRT  we put ass and everything is arranged by   [9:52] a fun pack so we have our DOT ass file  if we open it using a text editor you   [10:00] will find the syntax that is slightly  different so here you can see that the   [10:06] there's a different scanning you see dialog column  the beginning and the end of the end of time it is   [10:17] more or less a CSV like so you see that there is  all the effect the the resolver scanning of each   [10:27] line that you would like to display so a bit more  uh complicated to read but it's here available   [10:36] in another form now we extract it before the  German language but we would like to extract   [10:43] some more languages for us for me personally I'm  Italian so I would like to take the English and   [10:49] Italian language but now I don't know which is  the index of the different languages I think   [10:55] that I can do is to invoke FM pack in order to  see all the languages available so we said the   [11:04] first language is the the German one so um we  can okay invoke FF probe like this and see all   [11:14] the languages available again local style and  remember here I have a German English Spanish   [11:23] French Italian Dutch polish Portuguese Russian  and Vietnamese so for me the type of streams   [11:32] that I'm interested about are the English number  three and the Italian then take whatever you want   [11:40] I don't want to uh so just just an example  so what they can do is uh to invoke FM pack   [11:51] minus I name of the video then I take minus VN  that stands no video take minus uh a n no audio   [12:06] and then I'm selecting through the map the if you  can't remember how the map works I put the video   [12:14] here in the cart and what I would like to  map is the first sorry the um Italian and   [12:24] the English strikes so these are respectively the  number three and the number six what I can do is   [12:32] uh to take either the um absolute crack or the  relative track according to the type of string   [12:43] that I want so here uh what I can do is to put  the file number zero and the track number three   [12:53] something like this and then  I'm going to make a CS copy   [13:03] and the name of the file as  a singtel well la English [13:12] dot SRT so the same format as before [13:18] and now I have my English subtitles now  I'm going to check Vim name of the file   [13:27] and here I see that my subtitles are in English  what I would like to do is to also use the same   [13:38] command that I used before so this one but instead  of putting the absolute track so this is the track   [13:46] number three remember here we have S track the  number six that is the first second third fourth   [13:55] fifth track in the sequence so the fifth track is  a track number four and what you can do is a zero   [14:04] that was up our stream they want is a  subtitle and the track is number four   [14:11] here I take everything as it  was before so here I put Italian [14:21] I extract the video I'm sorry the  subtitle and here I have my Italian   [14:26] thread let me check if this is a really  the Italian one if I didn't miss any counts [14:35] and it seems Italian okay so  this is uh the right one cool   [14:42] okay now I have my English track I have my  Italian track what I would like to do now is   [14:48] to create a video with only the audio the video  and the subtitles so what I would like to do   [14:58] is to invoke again a fun pack minus I in this  case I get to take the first the second and   [15:06] the third file so first this then my sub first  subtitle track then the other subtitle track   [15:17] so my three files are rightly put then  I got to take the video from the first   [15:26] frame so I can take a map from the first  file I'm going to take the video tracks   [15:34] from the first file I'm going to take again all  the audio tracks and so for the other I'm going to   [15:44] take the subtitle tracks so I can take something  like this it has to be complete minus map   [15:54] yeah for the third file by number two I take  the same subtitle crash and then in the end   [16:01] I'm going to create my file my file can be with  the same name and with the reduced languages   [16:09] so what I can do is something like a singtel  let's say Italian and so English Italian and [16:23] so I want a matrushka video just suppose a thing   [16:31] like this I think that supports a copy  all the tracks so I would like to do uh [16:41] called B of everything so I can do also more  easily set of setting the video the audio and the   [16:49] subtitles what I can do is to put a minus C P so  everything will be a copy no transcoding implied   [16:59] see if it works it seems to work   [17:05] now it's putting all together and let's see what's  the result so everything is done in a copy way   [17:15] and let's see if the video is played so I'm  going to open it with VLC and see that the   [17:24] video is played perfectly I'm going to check also  if the titles are rightly put so here we've got   [17:32] the two tracks one I suppose it is the English  the other I suppose it is the Italian let's hope [17:41] so there's the the scene in the center  that has a dialogue I got to search for it [17:49] and the [17:56] matter here it is so here we have a the subtitles  in English and if I change to the other subtitles [18:08] we have the subtitles in Italian so cool that's  what we wanted okay good so now we have a video   [18:15] uh we have a languages but if we open this  video what we have is a video that has the   [18:23] subtitle as we want but it doesn't have the  references that are correct in the subtitle   [18:31] so if you see the subtitle track you see there is  track one track two but they're not so meaningful   [18:37] they don't mean anything to us so we don't  know if the first is the English the other   [18:43] is the Italian here it seems like the first  is the English one so what do you like to do   [18:49] is to detect to tell the software that we are in  uh so we want the scanning of all the subtitles   [18:59] so how can we do this thing we're going to invoke  action pack and we have to set a special metadata   [19:08] entry so here we're going to invoke FM pack  on our input files as we did before so minus I   [19:18] burst file minus I second file that is the English  subtitles then another I the Italian subtitles   [19:33] then what we will need to do is to map these  files accordingly so what can we do is uh to   [19:40] take the map uh video from the first file  and also map the audio from the first video   [19:52] cool then what we're going to take is from the  second file we're going to take the subtitles   [20:00] and the other has the subtitle  as well so we have a first video   [20:08] then so video from the first file audio from  the first file subtitles from the second file   [20:15] and subtitles from the second file so since  we have single streams we don't need to map   [20:21] accordingly this is a to make the things easier  okay so another thing that we can do is uh to   [20:30] set the titles accordingly so what can we do is  to set with the metadata flag so minus metadata [20:43] the name of the flag so the name of  the stream the name of the stream   [20:49] has to be put with the following  syntax so we got to put metadata   [20:55] no spaces so a column that  tells that this is a stream then [21:03] the we got to put a second s the s  in this case refers to the subtitle   [21:11] string so we want to take the first stream  as subtitles and uh the English language and   [21:20] the other subtitle as the Italian language  in an equivalent way we could also uh put   [21:31] a thing like this so stream two so it does the  same thing but to be a bit clearer I'm going to   [21:37] say that this is the first subtitle track and  what we need to put is a language to be said in   [21:46] English so the language need to have a certain  uh think text so with three letters the three   [21:55] letters are like the iso language style language  code and in this case the language is English   [22:04] and then finally we can put our output file  the output file in this case we can take either   [22:11] the same in this case so we can take English  Italian metadata sets so just to have a more   [22:21] remarkable name um yes so I forgot the thing for  the Italian language so here got to put metadata [22:32] again s s one because the second subtitle stream  is related to the Italian language the language   [22:41] equals to Eta that is for Italy Italian let's see  if the command works and now it's working we are   [22:52] waiting for the result it should be pretty  fast because we are doing we are performing   [22:57] um a string copy no it's no way not to perform  a string copy no I'm I'm wrong so I got to quit   [23:03] the process here got to put in the end after  the language the minus C topic so sorry guys [23:14] I was wrong and now we got the set the languages  let's see it now it works takes a while [23:30] but should be pretty fast okay good  finished and now let's give an FF probe   [23:36] just to understand if our languages are set  correctly they should be the metadatum with   [23:43] the name of the language so here FF probe  and there's a foreign we just created   [23:57] and we see that there is the stream for the  subtitles so the first is for the English the   [24:05] other is for the Italian so good we did what  we needed we needed to do if you would like to   [24:11] play the video also we can open it with the VLC  and VLC shows here in the subtitles and subtitle   [24:23] track we got the track one English and the second  one Italian so that's the thing that we wanted   [24:30] okay so we uh if we want now to put the subtitles  as burned on our video so for example we want the   [24:39] subtitle always be present uh on a video and  not as a subtitle track we got to heartburn   [24:47] the subtitles on top of the video this can be  done using a filter so there is the subtitles   [24:55] um subtitles filter and it works in this way  we have a FM pack we invoke the input file   [25:05] as this in this case we don't um give the name  of the input in the um in the FM back comment   [25:15] but we give it as input in the filter subtitles  that we see later so minus VF or minus filter [25:25] B subtitles is the name of the filter and then  we're going to take the name of the file so in   [25:35] this case uh let's use the English one and then  we can put as output the name of our file so since   [25:46] this is a video that uses a filter we cannot  stream copy we need to re-encode the video so   [25:53] we got to give the information about the video  in this case we can put h264 um then we're going   [26:03] to put the CRF the contrast the concentrate  factor of zero so it's a pretty big um so big   [26:13] but preserving the quality presets slow to be  as slow as possible and then generate a video   [26:22] with the best quality possible without any nasty  artifacts and the the audio we can copy it so   [26:33] we can take the Stream so the video  must be done from scratch the audio   [26:40] can be kept so what you can do is something  like this we put the hard burned subtitles   [26:53] and here we can change the video to MKV and  then we can run the program it can take a while [27:02] and so we are going to wait until the end of  the processing okay so now the video finished   [27:11] and we are ready to play it when we play it  and reach a point where we have subtitles   [27:20] here we can see that the subtitles are heartburned  just a little time and see that there is a a slow   [27:29] system and here you can see that this subtitle  is hard coded so there is no reference about   [27:36] the subtitles tracks okay so today we dealt with  subtitles uh we dealt how to manage the subtitles   [27:43] and how do they appear at least format a couple  of formats and then we saw how to include the   [27:53] subtitles within the videos and also how to  include the language inside the metadata so   [27:59] now we have the reference within the video and  with the different languages if you would like   [28:05] to put a multi-language subtitles if you want  to hard burn your uh your subtitles within the   [28:13] frames you can do it with the filter V subtitles  and the name of the title file you would like to   [28:19] put and you had subtitles directly put inside  the video we don't see the advanced options so   [28:26] you can change the font you can change the  style you can change many things you can   [28:33] also pay particular attention when you crop when  you trim the video so it takes something in the   [28:38] middle it requires some particular attention for  the moment this is the basis with which you wear   [28:46] um you can work with if you want to deal with  subtitles so thank you very much for watching   [28:51] if you reach this point uh I suggest  to like share and subscribe and hit   [28:56] the notification Bell here down below and  thank you very much and see you next time   [29:00] with new content regarding multimedia streams  and FM pack and much much more so bye ciao ciao [29:22] thank you