Video file to subtitles file

Muskan Sanghai muskansanghai at gmail.com
Sat Aug 29 09:27:14 EDT 2020


On Saturday, August 29, 2020 at 6:44:34 PM UTC+5:30, Barry Scott wrote:
> > On 29 Aug 2020, at 12:51, Muskan Sanghai <muskan... at gmail.com> wrote: 
> > 
> > On Friday, August 28, 2020 at 10:59:29 PM UTC+5:30, Chris Angelico wrote:
> >> On Sat, Aug 29, 2020 at 3:24 AM Barry <ba... at barrys-emacs.org <http://barrys-emacs.org/>> wrote: 
> >>> 
> >>> 
> >>> 
> >>>> On 28 Aug 2020, at 17:37, Muskan Sanghai <muskan... at gmail.com> wrote: 
> >>>> 
> >>>> On Friday, August 28, 2020 at 12:27:25 AM UTC+5:30, Barry Scott wrote: 
> >>>>>>> On 27 Aug 2020, at 18:00, Muskan Sanghai <muskan... at gmail.com> wrote: 
> >>>>>> 
> >>>>>> I would be really thankful if someone can suggest me how can I generate subtitles file (srt format) from a video or audio without using Google cloud and AWS. 
> >>>>> What do you know about how subtitles work with video? Do you mean you want to extract the bitmap subtitle data from a MPEG video? 
> >>>>> 
> >>>>> Barry 
> >>>>> 
> >>>>> 
> >>>>> 
> >>>>>> -- 
> >>>>>> https://mail.python.org/mailman/listinfo/python-list 
> >>>>>> 
> >>>> 
> >>>> Thank you Barry for your reply, 
> >>>> I just know the basics and I want to extract subtitles from a MPEG video and then put the subtitles in that same video. Subtitles can be of any format but it should be convenient for the entire procedure. 
> >>> 
> >>> It seems you are looking for an App to do this work? 
> >>> I searched the web and saw this. 
> >>> 
> >>> https://www.openshot.org/ 
> >>> 
> >>> I have not used this app, maybe it’s a starting point for you. 
> >>> 
> >>> Barry 
> >>> 
> >> Not familiar with Openshot, but it's worth looking into. 
> >> Alternatively, I'd definitely recommend ffmpeg for anything like this 
> >> sort of job. But if you actually need to OCR something, then you may 
> >> need to do some scripting work. I don't have code to offer you, but it 
> >> would involve FFMPEG to lift the images, something like Tesseract to 
> >> do the actual OCRing, and then you'd write the rest of it yourself in 
> >> Python. 
> >> 
> >> Other than that, this probably is something best done with a dedicated 
> >> movie editing tool, not Python. Use what exists. 
> >> 
> >> ChrisA 
> > I want to extract subtitles from a MPEG video (which does not have any previous subtitles)
> If it has no subtitles there is nothing to extract?
> > and then add them to the same video . 
> > So is it possible to do it with some scripting. Actually I tried to find the same features in FFMPEG but couldn't.
> ffmpreg I doubt has the APIs you need for this. 
> 
> Have a look at GStreamer, which has pytohn APIs. I know it can handle subtitles because the company 
> I used to work for paid for subtitle support to be added to GStreamer for a product 
> I worked on a few years ago. 
> 
> I recall that in MPEG subtitles are RLE encoded bitmaps with timing and position data. 
> Which allows the player to show this bitmap at position X, Y starting at T0 and remove at t1 etc. 
> You have to track multiple subtitles at the same time. 
> 
> You should be able to extract the subtitle bit maps and timing data with modest work. 
> You could use OCR technology to turn the subtitles into text. 
> 
> Barry 
> 
> 
> > -- 
> > https://mail.python.org/mailman/listinfo/python-list <https://mail.python.org/mailman/listinfo/python-list>
Actually the video is in MP4 format and does not have subtitles in it. But I will surely try to use GStreamer as you have suggested.


More information about the Python-list mailing list