├── .gitignore ├── LICENSE ├── README.md ├── samples ├── a │ ├── a.srt │ ├── a.webm │ └── output │ │ ├── frame0001.jpg │ │ ├── frame0002.jpg │ │ ├── frame0004.jpg │ │ ├── frame0008.jpg │ │ ├── frame0011.jpg │ │ ├── frame0015.jpg │ │ ├── frame0017.jpg │ │ ├── frame0019.jpg │ │ ├── frame0023.jpg │ │ ├── frame0027.jpg │ │ ├── frame0029.jpg │ │ ├── frame0031.jpg │ │ ├── frame0034.jpg │ │ ├── frame0036.jpg │ │ ├── frame0040.jpg │ │ ├── frame0044.jpg │ │ ├── frame0047.jpg │ │ ├── frame0050.jpg │ │ ├── frame0052.jpg │ │ └── frame0055.jpg ├── b │ ├── b.mp4 │ ├── b.srt │ └── output │ │ ├── frame0003.jpg │ │ ├── frame0008.jpg │ │ ├── frame0012.jpg │ │ ├── frame0020.jpg │ │ ├── frame0028.jpg │ │ ├── frame0034.jpg │ │ ├── frame0037.jpg │ │ ├── frame0048.jpg │ │ └── frame0055.jpg └── moon │ └── selected │ ├── frame0577.jpg │ ├── frame0631.jpg │ ├── frame0895.jpg │ ├── frame1126.jpg │ ├── frame1517.jpg │ ├── frame2128.jpg │ ├── frame2576.jpg │ ├── frame2639.jpg │ ├── frame2783.jpg │ ├── frame3030.jpg │ ├── frame3223.jpg │ ├── frame3432.jpg │ ├── frame3834.jpg │ ├── frame4107.jpg │ ├── frame4188.jpg │ ├── frame4278.jpg │ ├── frame4665.jpg │ ├── frame4767.jpg │ ├── frame4878.jpg │ ├── frame4986.jpg │ ├── frame5041.jpg │ ├── frame5298.jpg │ ├── frame5388.jpg │ └── frame5485.jpg └── script.py /.gitignore: -------------------------------------------------------------------------------- 1 | samples/moon/out/* -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Rohan Verma 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SubScribe 2 | Python Utility to convert your video files to images transcribed with their subtitles. 3 | 4 | ##The Idea 5 | 1. Download a video using `youtube-dl https://www.youtube.com/watch?v=PTmCxbcRXs4 --write-auto-sub` 6 | 2. Run a script that uses the mp4 file and the srt file to generate an image (or a set of images) like this: 7 | ![Image](https://scontent-hkg3-1.xx.fbcdn.net/hphotos-xpt1/v/t1.0-9/11139985_643154262493379_4766804901696677874_n.jpg?oh=97e2bc0a211442c11167744906e197de&oe=56C052AE) 8 | 9 | 10 | ## Usage 11 | 1. Download a video using `youtube-dl https://www.youtube.com/watch?v=PTmCxbcRXs4 --write-auto-sub` or just have a video file with a corresponding srt file ready. 12 | 2. How to use: 13 | 14 | ``` 15 | python script.py --help 16 | usage: script.py [-h] video sub 17 | 18 | positional arguments: 19 | video path to video file 20 | sub path to sub file 21 | 22 | optional arguments: 23 | -h, --help show this help message and exit 24 | ``` 25 | 26 | 3. Examples: 27 | `python script.py samples/a/a.webm samples/a/a.srt` 28 | 29 | ## Sample Outputs 30 | 31 | ###Moon Movie 32 | ![Image](samples/moon/selected/frame0577.jpg) 33 | ![Image](samples/moon/selected/frame0631.jpg) 34 | ![Image](samples/moon/selected/frame4188.jpg) 35 | ![Image](samples/moon/selected/frame5041.jpg) 36 | 37 | 38 | 39 | ###Sample Youtube Videos 40 | ![Image](samples/a/output/frame0034.jpg) 41 | ![Image](samples/b/output/frame0055.jpg) 42 | 43 | ## Todo 44 | - [ ] Think of a cool name for the repo. 45 | - [ ] Add an optional youtube-dl wrapper 46 | - [ ] Add to pip 47 | - [ ] Improve text overlay, make it more visible and allow it to be modified using CLI 48 | - [x] Add demos to readme. 49 | - [ ] Add contributing.md 50 | 51 | 52 | 53 | 54 | ## Contributing 55 | Post issues and send PRs. 56 | -------------------------------------------------------------------------------- /samples/a/a.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:01,790 --> 00:00:03,010 3 | stop being so hopeful 4 | 5 | 2 6 | 00:00:03,010 --> 00:00:06,420 7 | expect that most things are going to go 8 | wrong married job holidays 9 | 10 | 3 11 | 00:00:06,420 --> 00:00:10,010 12 | kids look at the glass half empty and 13 | then feel grateful whenever things 14 | 15 | 4 16 | 00:00:10,010 --> 00:00:13,360 17 | art and outcry catastrophe stop ranting 18 | about how awful 19 | 20 | 5 21 | 00:00:13,360 --> 00:00:17,359 22 | other people are mister knowing people 23 | are people interest anxious to see to 24 | 25 | 6 26 | 00:00:17,359 --> 00:00:17,800 27 | deepen 28 | 29 | 7 30 | 00:00:17,800 --> 00:00:21,080 31 | they didn't set out to hurt you just 32 | under a lot of pressure think 33 | 34 | 8 35 | 00:00:21,080 --> 00:00:25,250 36 | death lot keeper Scala new table you 37 | probably got about 400,000 38 | 39 | 9 40 | 00:00:25,250 --> 00:00:29,140 41 | laughable said stop thinking this 42 | officer stupid 43 | 44 | 10 45 | 00:00:29,140 --> 00:00:33,329 46 | something for myself love looking 47 | forward make Britain repentance to talk 48 | 49 | 11 50 | 00:00:33,329 --> 00:00:35,030 51 | with someone you don't spend enough time 52 | 53 | 12 54 | 00:00:35,030 --> 00:00:38,570 55 | you ask yourself what you really want an 56 | anxious about 57 | 58 | 13 59 | 00:00:38,570 --> 00:00:43,430 60 | stop trying to make yourself happy it's 61 | impossible concentrate and cheering up 62 | 63 | 14 64 | 00:00:43,430 --> 00:00:46,940 65 | you get yourself tested from I S S 240 66 | miles above the earth 67 | 68 | 15 69 | 00:00:46,940 --> 00:00:49,969 70 | from this height lots of things that are 71 | bothering you look for signs they should 72 | 73 | 16 74 | 00:00:49,969 --> 00:00:51,000 75 | always have been 76 | 77 | 17 78 | 00:00:51,000 --> 00:00:54,390 79 | through your phone off a cliff for a bit 80 | so you can finally noticed 81 | 82 | 18 83 | 00:00:54,390 --> 00:00:57,969 84 | especially a partner and your mom give 85 | up on the idea that we should be normal 86 | 87 | 19 88 | 00:00:57,969 --> 00:01:01,059 89 | the only normal people people you don't 90 | know yet everyone is weird 91 | 92 | 20 93 | 00:01:01,059 --> 00:01:02,100 94 | its conclusion came 95 | 96 | -------------------------------------------------------------------------------- /samples/a/a.webm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/a/a.webm -------------------------------------------------------------------------------- /samples/a/output/frame0001.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/a/output/frame0001.jpg -------------------------------------------------------------------------------- /samples/a/output/frame0002.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/a/output/frame0002.jpg -------------------------------------------------------------------------------- /samples/a/output/frame0004.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/a/output/frame0004.jpg -------------------------------------------------------------------------------- /samples/a/output/frame0008.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/a/output/frame0008.jpg -------------------------------------------------------------------------------- /samples/a/output/frame0011.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/a/output/frame0011.jpg -------------------------------------------------------------------------------- /samples/a/output/frame0015.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/a/output/frame0015.jpg -------------------------------------------------------------------------------- /samples/a/output/frame0017.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/a/output/frame0017.jpg -------------------------------------------------------------------------------- /samples/a/output/frame0019.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/a/output/frame0019.jpg -------------------------------------------------------------------------------- /samples/a/output/frame0023.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/a/output/frame0023.jpg -------------------------------------------------------------------------------- /samples/a/output/frame0027.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/a/output/frame0027.jpg -------------------------------------------------------------------------------- /samples/a/output/frame0029.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/a/output/frame0029.jpg -------------------------------------------------------------------------------- /samples/a/output/frame0031.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/a/output/frame0031.jpg -------------------------------------------------------------------------------- /samples/a/output/frame0034.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/a/output/frame0034.jpg -------------------------------------------------------------------------------- /samples/a/output/frame0036.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/a/output/frame0036.jpg -------------------------------------------------------------------------------- /samples/a/output/frame0040.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/a/output/frame0040.jpg -------------------------------------------------------------------------------- /samples/a/output/frame0044.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/a/output/frame0044.jpg -------------------------------------------------------------------------------- /samples/a/output/frame0047.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/a/output/frame0047.jpg -------------------------------------------------------------------------------- /samples/a/output/frame0050.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/a/output/frame0050.jpg -------------------------------------------------------------------------------- /samples/a/output/frame0052.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/a/output/frame0052.jpg -------------------------------------------------------------------------------- /samples/a/output/frame0055.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/a/output/frame0055.jpg -------------------------------------------------------------------------------- /samples/b/b.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/b/b.mp4 -------------------------------------------------------------------------------- /samples/b/b.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:00,000 --> 00:00:06,040 3 | this is who I am making fun and make a 4 | joke on Twitter the day of the tragedy 5 | 6 | 2 7 | 00:00:06,040 --> 00:00:10,880 8 | of people who see something horrible 9 | happened the world they're under the 10 | 11 | 3 12 | 00:00:10,880 --> 00:00:15,880 13 | internet under their social media 14 | Facebook to Twitter whatever they got 15 | 16 | 4 17 | 00:00:15,880 --> 00:00:26,590 18 | and they all right down the exact same 19 | thing my thoughts and prayers 20 | 21 | 5 22 | 00:00:26,590 --> 00:00:31,530 23 | my thoughts and prayers with the people 24 | in Aurora my thoughts and prayers are 25 | 26 | 6 27 | 00:00:31,530 --> 00:00:44,300 28 | with the families and Boston you know 29 | what that's worth noting 30 | 31 | 7 32 | 00:00:44,300 --> 00:00:53,379 33 | your money or even your compassion all 34 | you are doing all you are doing is 35 | 36 | 8 37 | 00:00:53,379 --> 00:00:57,399 38 | saying don't forget about me today 39 | 40 | 9 41 | 00:00:57,399 --> 00:01:12,710 42 | distractions in the news right now but 43 | don't forget how sad I am 44 | 45 | -------------------------------------------------------------------------------- /samples/b/output/frame0003.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/b/output/frame0003.jpg -------------------------------------------------------------------------------- /samples/b/output/frame0008.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/b/output/frame0008.jpg -------------------------------------------------------------------------------- /samples/b/output/frame0012.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/b/output/frame0012.jpg -------------------------------------------------------------------------------- /samples/b/output/frame0020.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/b/output/frame0020.jpg -------------------------------------------------------------------------------- /samples/b/output/frame0028.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/b/output/frame0028.jpg -------------------------------------------------------------------------------- /samples/b/output/frame0034.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/b/output/frame0034.jpg -------------------------------------------------------------------------------- /samples/b/output/frame0037.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/b/output/frame0037.jpg -------------------------------------------------------------------------------- /samples/b/output/frame0048.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/b/output/frame0048.jpg -------------------------------------------------------------------------------- /samples/b/output/frame0055.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/b/output/frame0055.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame0577.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame0577.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame0631.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame0631.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame0895.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame0895.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame1126.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame1126.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame1517.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame1517.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame2128.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame2128.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame2576.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame2576.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame2639.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame2639.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame2783.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame2783.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame3030.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame3030.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame3223.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame3223.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame3432.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame3432.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame3834.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame3834.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame4107.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame4107.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame4188.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame4188.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame4278.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame4278.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame4665.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame4665.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame4767.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame4767.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame4878.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame4878.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame4986.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame4986.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame5041.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame5041.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame5298.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame5298.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame5388.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame5388.jpg -------------------------------------------------------------------------------- /samples/moon/selected/frame5485.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhnvrm/SubScribe/0a7c8162aa56d09184ee3f66b7d3c99f5edd4456/samples/moon/selected/frame5485.jpg -------------------------------------------------------------------------------- /script.py: -------------------------------------------------------------------------------- 1 | __author__ = 'rhnvrm ' 2 | 3 | import cv2 4 | import pysrt 5 | import argparse 6 | 7 | def mid(x,y): 8 | return (x+y)/2 9 | 10 | def save_new_frame(file, ms, text): 11 | 12 | videocapture = cv2.VideoCapture(videofile) 13 | videocapture.set(cv2.cv.CV_CAP_PROP_POS_MSEC,ms) 14 | success, image = videocapture.read() 15 | 16 | height, width = image.shape[:2] 17 | 18 | if success: 19 | font = cv2.FONT_HERSHEY_SIMPLEX 20 | 21 | overlay = image.copy() 22 | 23 | cv2.rectangle(overlay, (1, height-15-11), (width-1, height-1), (255,0,0), -1) 24 | 25 | opacity = 0.4 26 | 27 | cv2.addWeighted(overlay, opacity, image, 1 - opacity, 0, image) 28 | 29 | cv2.putText(image,text,(10,height-10), font, 0.4,(255,255,255),1) 30 | cv2.imwrite('frame%04d.jpg' % (ms/1000), image) 31 | #cv2.imshow('frame%d % (ms)', image) 32 | #cv2.waitKey() 33 | 34 | if __name__ == "__main__": 35 | parser = argparse.ArgumentParser() 36 | 37 | parser.add_argument('video', help = 'path to video file') 38 | parser.add_argument('sub', help = 'path to sub file') 39 | 40 | args = parser.parse_args() 41 | 42 | subs = pysrt.open(args.sub) 43 | videofile = args.video 44 | 45 | for i in xrange(0, len(subs)): 46 | seconds_start = (subs[i].start.seconds) + (subs[i].start.minutes * 60) + (subs[i].start.hours * 60 * 60) 47 | seconds_end = (subs[i].end.seconds) + (subs[i].end.minutes * 60) + (subs[i].end.hours * 60 * 60) 48 | ms = mid(seconds_start*1000,seconds_end*1000) 49 | save_new_frame(videofile, ms, str(subs[i].text)) 50 | --------------------------------------------------------------------------------