0

I have hundreds of folders of Spanish short stories, with each folder having dozens of individual .MP3 files for each dialogue spoken. Along with the .MP3 files, lies in the folder, a JSON file of the format ["folder1-dialogue-1", "folder1-dialogue-2",...].

I want to generate images, each containing the text values of the JSON file, like folder1-dialogue-1 and generate videos combining that image with its corresponding audio (folder1-dialogue-1.mp3), and then merge all the videos in the folder into one - folder1.mp4

How do I go about doing this?

P.S I'm not straight up asking for code, but just advice as to how I go about doing this.

yociba
  • 1
  • 2
    `iconv` ***may be*** of some help for your text processing. `jq` will help you "spit out" chunks of dialog (it would be nice if your sample data showed some actual dialog (even just "This is dialog") ). I would think this will ether be a "bash-as-glue" script, or a "real-live-go-program", but I'd recommend at least doing your research with bash. You may realize go is unnecessary (or that is completely necessary!). Good luck. – shellter Sep 16 '20 at 15:03
  • 2
    You could: 1) create dummy empty image; 2) calculate runtime of each mp3 file; 3) use timing information to convert json into subtitle format such as [SRT](https://en.wikipedia.org/wiki/SubRip); 4) use ffmpeg to combine subtitle, audio, and image. For example, see: https://stackoverflow.com/q/25891342/10971581 https://superuser.com/q/1181082/990780 – jhnc Sep 16 '20 at 15:08
  • 1
    also note that `imagemagick` is able to render text (on its internal in-memory canvas) and save the resulting image to a file. – kostix Sep 16 '20 at 16:01
  • yes, get your `jq` filter to pipe to `imagemagick` and into a tmp file to contain the text. Once you get some code together don't be afraid to pose a Q again (try to make it simple, regarding one part of your project). Also, one time saving `bash` resource is https://shellcheck.net , but some messages it produces are relatively arcane. When it is pointing a a particular line and you don't understand the issue, try pasting the error to your favorite search engine, along with the word `bash`. Good luck. – shellter Sep 16 '20 at 16:05
  • Your Q may still get vote-closed, so keep a copy of these comments ;-) . – shellter Sep 16 '20 at 16:06
  • If the goal is to create a video that displays the text as video, you could extract the text to srt or ass (for styled text) and include it as a hard-coded subtitle with a static base image. if you are consistent and logical with your filenames you could run it in a for-each loop: fileName.1.mp3 belongs to item 1 in the json, or fileName.1.json witch is easier to handle.. With Ffprobe you get the duration of the audio so you can dynamically create a subtitle for the entire duration saving them as fileName.1.srt, create the video. Stitch them together at the end. – Stoney Eagle Sep 20 '20 at 13:00

0 Answers0