1

I have an mp4 video file that is a recording of a basic text Powerpoint slideshow. It is about 1 hour long and has about 900 slides. You can think of it as a karaoke video: each slide shows just 1 sentence of text (or less).

None of the formatting of the text matters (and if there are any images on any of the slides, they don't matter).

I do not have the original Powerpoint file anymore.

I would love to be able to create an editable Powerpoint file out of this video.

Perhaps 3 steps are required:

  1. Generate image files from the video, where there is a new image for each "scene change" of the video (i.e. when a new slide is shown).

  2. Use some sort of automated optical character recognition program to convert those images into a long text file. Text would be grabbed from each image and appended to the text file. Each new line of the text file would represent a slide/image.

  3. Somehow produce a Powerpoint file where each of its slides is generated by the text file (one slide per line of text). The Powerpoint can be completely basic (white background, default black centered text).

For Step 1, my current approach (which I'm not sure is the best way) is to use ffmpeg like this:

ffmpeg -i my_video.mp4 -frames:v 1 my_subfolder/my_slides-00000.jpg

ffmpeg -i my_video.mp4 -vf select="gt(scene\,0.01)" -vsync 0 -an my_subfolder/my_slides-%05d.jpg

I would appreciate any suggestions for Steps 2 and 3 (or improvements to Step 1).

Your suggestions do not need to be limited to consumer-friendly software; I'm a software engineer and am happy to write scripts / code if necessary. Thanks.

1

For Step 3, I found out that Powerpoint allows importing a text file where each line of the text file becomes the headline of the slide. So by editing the Master slide (to position and format the "headline" how I want), I'm able to import a whole set of slides and make them look decent.

For Step 2:

I discovered https://github.com/tesseract-ocr/tesseract/wiki, which is open source OCR. Then I coded this custom PHP script to be called from AJAX:

require dirname(__FILE__) . "/vendor/autoload.php";
$num = $_GET['num'];
$zeroPaddedNumber = str_pad($num, 5, "0", STR_PAD_LEFT); //'00038'
$imageFileName = 'C:\videos\screenshots-' . $zeroPaddedNumber . '.jpg';
$tesseract = new TesseractOCR($imageFileName); //myimage.png
$text = $tesseract->recognize();
$dividingLine = "____________________";
$contentWithDivider = $text . PHP_EOL . $dividingLine . PHP_EOL;
echo $text . '<br/>';
$flag = ($num <= 1) ? null : FILE_APPEND;
file_put_contents("C:\\videos\\lines.txt", $contentWithDivider, $flag);

This worked pretty well!

  • Ahhh and this was super helpful too: support.office.com/en-us/article/… I can create a Word doc with Heading 1 for slide titles and Heading 2 for bullets, and I can even stylize H2 within the doc to look like bullets in Word. So I create the whole slideshow outline in Word, save the doc, then import into PowerPoint, and it generates the slides. – Ryan May 31 at 22:28
0

Working on the not afraid of writing some scripts:

For stage 1 - extract key frames only by starting at the first frame and comparing and discarding the next until a threshold difference is found, (maybe 5%), then take that frame as the next key frame and continue this will cut down the number of frames that you need to OCR drastically - for this I would use python and either the OpenCV bindings or ImageMagick. Worth recording the time stamp of each candidate file at this point possibly by embedding into the filename.

For stage 2 - Install tesseract-ocr and the python bindings or Asprise OCR with python - either will let you output in just about any text format that you chose.

Stage 2a - You may wish to compare the output of each OCR to make sure that it is not the same as the previous, e.g. if the text colour changes it may trigger a new over threshold frame capture dispute there not being a text content change.

Stage 3 - If you are working in python you may wish to generate the PowerPoint file directly, possibly using the time stamps recorded earlier, using python-pptx

All of the above is either Open Source or Royalty Free software. One last point, egg sucking time, be prepared to wait quite a long time to process the 900 slides so do a test with just the first few minutes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.