Writing video using AVAssetWriter, AVAssetReader, and AVSPEECHSYNTHESIZER

Hello,

First, some version and software details:

  • Software: iOS 18.1
  • Hardware: iPhone 14 Pro Max and later
  • Xcode: 16.0

Summary: AVAssetReader is not concatenating a video at the beginning of the output video. The output video should contain a scene of me introducing the content, followed by a blue screen with AVSpeechSynthesizer reading out a text that I pasted above the "Generate Video" button.

Details:

Now, let's talk about the app.

Basically, I’m developing an app that generates a video with the following features:

  • My app will create an output video that is split into an opening scene followed by a fully blue screen.
  • The opening scene will be taken from a video I choose from my gallery.
  • I will read the opening video using AVAssetReader as usual.
  • After the opening scene, I will use the content of a text read by AVSpeechSynthesizer.write().
  • After the opening scene, the synthesized audio will start playing while the blue screen is displayed.

All of this is already defined in the attached project.

Each project file has a comment at the beginning introducing its content.

How to test:

  1. Write something in the field above the "Generate Video" button. For example, type "Hello, world!"
  2. Then, press the "Library" button and select a video from the gallery, about 30 seconds long.
  3. That’s it. Press the "Generate Video" button.

The result I’ve experienced is a crash or failure to generate the video.

Practical example of what I want to achieve:

Suppose I record a 30-second video where I say, "I’m going to tell you the story of Snow White."
Then, I paste the "Snow White" story into the field above the "Generate Video" button.

The output video should contain me saying, "I’m going to tell you the story of Snow White."
After that, the AVSpeechSynthesizer will read the story I pasted, while displaying a blue screen.

I look forward to a solution.

Thank you very much!

Hello @Paulo_DEV01,

Thanks for bringing this question to the community!

A couple of follow-up questions:

  1. Can you provide a link to download your example project? Assembling it from the swift files would be quite cumbersome, and might miss something essential.

  2. You mentioned that your app crashes, do you have a crash log, or an error message?

Best regards,

Greg

Hello!

I have a few questions' I don't use GitHub since I am deafblind and a Braille display user. I avoid overloading my usage with extra resources, as accessibility tends to complicate things' If I provide a link, should the project be temporary, or must I leave it there permanently?

As for a crash log, I don't have one, but the project is very small' I don’t have an error message either'

Thank you!

Hello!

See if this link works .

Hello Paulo,

Unfortunately that link did not work, it says I am either not authorized, or the content has been removed.

I avoid overloading my usage with extra resources, as accessibility tends to complicate things' If I provide a link, should the project be temporary, or must I leave it there permanently?

I understand, feel free to submit this as a code-level support request. When you submit your request, please mention this thread as well! Once you submit your request, you will be able to attach your project in a follow-up.

Best regards,

Greg

Hello,
I tried to open the code-level support request twice, but I am not receiving the automatic email.

Hello,

I am not receiving automatic email when I send messages to the Developer Technical support.

Help me.

Hello,

I have already sent the attachment via email. Now I am just waiting for a response.

Writing video using AVAssetWriter, AVAssetReader, and AVSPEECHSYNTHESIZER
 
 
Q