title: Python CV2 extract video frames with subtitles
body: <p>I have a video file <code>result.mp4</code> with subtitles. I want to extract frames, but I want subtitles to be on those frames too, subtitles are in file as a separate track.</p>
  
  <p>Currently I use this code to extract:</p>
  
  <pre><code>vidcap = cv2.VideoCapture("result.mp4")
  success,image = vidcap.read()
  count = 0
  while success:
    cv2.imwrite("frame%d.jpg" % count, image)     
    success,image = vidcap.read()
    print('Read a new frame: ', success)
    count += 1
  </code></pre>
  
  <p>which works fine, but as I said, does not include subtitles on the frames. I am able to extract frames with subtitles only if I hardcode subtitles into video which looks different and takes a lot of time.</p>
  
  <p>Is there a way for opencv to extract frames with subs that are on separate track?</p>
  
  <p>FYI:
  I use this FFMPEG command to merge <code>.mp4</code> with <code>.srt</code>:</p>
  
  <pre><code>ffmpeg -i ourvid.mp4 -i ourvid.srt -c:s mov_text -c:v copy -c:a copy result.mp4 -f srt
  </code></pre>
  
  <p>which completes in around a second</p>
  
  <p>if I hardcode it however:</p>
  
  <pre><code>ffmpeg -i ourvid.mp4 -vf "subtitles=ourvid.srt" result.mp4
  </code></pre>
  
  <p>it takes on average at least half of the length of the source video (in completion time)</p>