Closed howardbaek closed 1 year ago
Can you post a reprex/MCVE
Thanks for the quick reply, @muschellij2
Since our last meeting with @cansavvy, we decided to use the coqui-ai/TTS library as our free TTS engine. Using this, I generated .wav
files and input them and the PNG image files into ari_stitch()
, but ran into this aforementioned bug.
I edited my original post with a reprex, which contains the R scripts + ari_stitch()
function body + PNG files + WAV files needed to reproduce my problem.
OK - just FYI, I'm not working on this currently, so probably won't look at it for a few weeks.
I figured out the bug!
When I was testing out ari_stitch()
, I had removed line 195-197. I thought that was a typo because we were using the i
from the previous for-loop. I didn't know that for
assigns the i
to the current environment, overwriting any existing variable with the same name (https://adv-r.hadley.nz/control-flow.html#loops).
Instead of images[i]
, I think this is a more direct expression: images[length(images)]
. So, future self will not be confused again.
This change is committed here: https://github.com/jhudsl/ari/pull/40/commits/247a33b10c1c260985606b51408e7d9511b31d85#diff-61326062bb54dd0efa36b7319032beda8de959a05922fd7d5904a36ba407e46cR198
When I run
ari_stitch()
on the images/audio generated from this test set of Google slides, I get a video file where the last slide is missing.For example, if I have 6 PNG images and 6 WAV audio files, I only get 5 of them weaved in the final output.
Reproducible Example:
utils.R
set_encoders.R
ffmpeg_codecs.R
Setup (Source above three R scripts and define
ari_stitch()
Image Files
slide1.png
slide2.png
slide3.png
slide4.png
slide5.png
slide6.png
Audio Files
audio_files.zip
Run ari_stitch()
Navigate to this mp4 in Finder (Mac) and open the video
Message when running
res <- system(command)
: