Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subtitles not working on Azure Function #499

Open
keke1210 opened this issue Jan 31, 2024 · 0 comments
Open

Subtitles not working on Azure Function #499

keke1210 opened this issue Jan 31, 2024 · 0 comments

Comments

@keke1210
Copy link

keke1210 commented Jan 31, 2024

I have deployed an azure function with ffmpeg.exe. The function adds audio and srt/ass subtitles to a video.
When I test locally this code works (running on azurite). When I deploy The audio is added to the video but the subtitles don't show up. I've tried with SRT and ASS but they both don't work using this code.

What am I doing wrong?

await FFMpegArguments
 .FromFileInput(videoInputPath, true, options =>
 {
     options.WithCustomArgument("-stream_loop -1");
 })
 .AddFileInput(audioPath, true)
 .OutputToFile(videoOutputPath, true, (options) =>
 {
     options.WithDuration(thread.AudioData.TotalAudioDuration);

     options.WithVideoCodec(VideoCodec.LibX264);   // Re-encode video using x264 codec
     options.WithAudioCodec(AudioCodec.Aac);       // Re-encode audio to AAC
     options.WithSpeedPreset(Speed.VeryFast);
     options.UsingShortest(true);

     options.WithVideoFilters((videoOptions) =>
     {
         videoOptions.HardBurnSubtitle(SubtitleHardBurnOptions.Create(subtitlesFile));
     });
 }).ProcessAsynchronously();

Here's the command it creates on Azure function:

-stream_loop -1 -i "C:\local\Temp\videoTempPath.mp4" -i "C:\local\Temp\audioTempPath.mp3" -t 00:00:22.8160000 -c:v libx264 -c:a aac -preset veryfast -shortest -vf "subtitles='C\:\\local\\Temp\\subtitles.srt'" "C:\local\Temp\output.mp4" -y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant