Recherche avancée

Médias (91)

Sur d’autres sites (95)

  • FFMPEG is not working in app service post deployment

    1er mars, par Tushar Gupta

    I using the Xabe.FFmpeg package to generate clips from a video. The code is basically converting a video to multiple clips and it's working fine in my local but whenever I am uploading the code to app service the code is not working.

    


    Stack : .net
App Service OS : Windows

    


    Error :

    


    2024-02-13 08:57:34.092 +00:00 [Error] Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer : Connection ID "16573246629528734243", Request ID "40000a24-0000-e600-b63f-84710c7967bb" : An unhandled exception was thrown by the application.System.ComponentModel.Win32Exception (193) : An error occurred trying to start process 'C :\home\site\wwwroot\Controllers\ffmpeg\bin\ffmpeg.exe' with working directory 'C :\home\site\wwwroot'. The specified executable is not a valid application for this OS platform.at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)at System.Diagnostics.Process.Start()at Xabe.FFmpeg.FFmpeg.RunProcess(String args, String processPath, Nullable1 priority, Boolean standardInput, Boolean standardOutput, Boolean standardError)at Xabe.FFmpeg.FFmpegWrapper.&lt;>c__DisplayClass14_0.<runprocess>b__0()at System.Threading.Tasks.Task</runprocess>1.InnerInvoke()at System.Threading.Tasks.Task.<>c.<.cctor>b__281_0(Object obj)at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)--- End of stack trace from previous location ---at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)--- End of stack trace from previous location ---at Xabe.FFmpeg.Conversion.Start(String parameters, CancellationToken cancellationToken)at ExtractResponseAPI.Controllers.HomeController.PrepareVideoClips(CloudBlockBlob sourceVideoBlob, TimeSpan startTime, TimeSpan endTime) in C :\Users\tushar.h.gupta\source\repos\ExtractResponseAPI\Controllers\HomeController.cs:line 164at ExtractResponseAPI.Controllers.HomeController.GetIntervalsAsync(String query) in C :\Users\tushar.h.gupta\source\repos\ExtractResponseAPI\Controllers\HomeController.cs:line 60at ExtractResponseAPI.Controllers.HomeController.Get(String query) in C :\Users\tushar.h.gupta\source\repos\ExtractResponseAPI\Controllers\HomeController.cs:line 24at lambda_method4(Closure, Object)at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask)at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<invokenextactionfilterasync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State&amp; next, Scope&amp; scope, Object&amp; state, Boolean&amp; isCompleted)at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<invokeinnerfilterasync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<invokefilterpipelineasync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<invokeasync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<invokeasync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT</invokeasync></invokeasync></invokefilterpipelineasync></invokeinnerfilterasync></invokenextactionfilterasync>1.ProcessRequestAsync()

    &#xA;

    Code :

    &#xA;

    private async Task> PrepareVideoClips(CloudBlockBlob sourceVideoBlob, TimeSpan startTime, TimeSpan endTime)&#xA;{&#xA;    string tempDirectory = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());&#xA;&#xA;    // Create a temporary directory to store clips locally&#xA;    Directory.CreateDirectory(tempDirectory);&#xA;&#xA;    // Download the source video&#xA;    string sourceVideoPath = Path.Combine(tempDirectory, "sourceVideo.mp4");&#xA;    await sourceVideoBlob.DownloadToFileAsync(sourceVideoPath, FileMode.Create);&#xA;    FFmpeg.SetExecutablesPath("Controllers\\ffmpeg\\bin\\");&#xA;    // Use FFmpegCore to trim the video&#xA;    string outputVideoPath = Path.Combine(tempDirectory, "output.mp4");&#xA;&#xA;    await FFmpeg.Conversions.New()&#xA;        .AddParameter($"-ss {startTime.TotalSeconds}") // Start time&#xA;        .AddParameter($"-i {sourceVideoPath}")&#xA;        .AddParameter($"-to {(endTime - startTime).TotalSeconds}") // Duration&#xA;        .SetOutput(outputVideoPath)&#xA;        .Start();&#xA;&#xA;    // Return a list of file paths for the clips&#xA;    return new List<string> { outputVideoPath };&#xA;}&#xA;</string>

    &#xA;

    I tried deploying the app service using different OS but still facing the same issue, I also tried using different packages but the result is same.

    &#xA;

  • Correct usage of fdkaac for liquidsoap->icecast

    1er février, par user4893295

    Can't seem to get aac working using fdkaac with liquidsoap. It just seems to shutdown.

    &#xA;

    TBF I have no idea which aot or transmux to use for "normal" icecast stuff. mp3 works fine, and the icecast server works fine with aac from other sources (BUTT etc).

    &#xA;

    This is my starting point from the liquidsoap cookbook :

    &#xA;

    %fdkaac(channels=2, samplerate=44100, bandwidth="auto", bitrate=64, afterburner=false, aot="mpeg2_he_aac_v2", transmux="adts", sbr_mode=false)&#xA;

    &#xA;

    And this is my output from liquidsoap :

    &#xA;

    2024/02/01 20:49:05 [clock:3] Using native (high-precision) implementation for latency control&#xA;2024/02/01 20:49:07 [main:3] Standard library loaded in 1.64 seconds.&#xA;2024/02/01 20:49:07 [lang:2] WARNING: "set" is deprecated and will be removed in future version. Please use `settings.path.to.key := value`&#xA;2024/02/01 20:49:07 [lang:2] WARNING: "set" is deprecated and will be removed in future version. Please use `settings.path.to.key := value`&#xA;2024/02/01 20:49:07 [frame:3] Using 44100Hz audio, 25Hz video, 44100Hz main.&#xA;2024/02/01 20:49:07 [frame:3] Video frame size set to: 1280x720&#xA;2024/02/01 20:49:07 [frame:3] Frame size must be a multiple of 1764 ticks = 1764 audio samples = 1 video samples.&#xA;2024/02/01 20:49:07 [frame:3] Targeting &#x27;frame.duration&#x27;: 0.04s = 1764 audio samples = 1764 ticks.&#xA;2024/02/01 20:49:07 [frame:3] Frames last 0.04s = 1764 audio samples = 1 video samples = 1764 ticks.&#xA;2024/02/01 20:49:07 [sandbox:3] Could not find binary bwrap, disabling sandboxing.&#xA;2024/02/01 20:49:07 [startup:3] DSSI plugins registration: 0.00s&#xA;2024/02/01 20:49:07 [startup:3] FFmpeg filters registration: 0.02s&#xA;2024/02/01 20:49:07 [startup:3] FFmpeg bitstream filters registration: 0.00s&#xA;2024/02/01 20:49:07 [startup:3] Lilv plugins registration: 0.00s&#xA;2024/02/01 20:49:07 [startup:3] Frei0r plugin registration: 0.00s&#xA;2024/02/01 20:49:07 [startup:3] LADSPA plugins registration: 0.00s&#xA;2024/02/01 20:49:07 [startup:3] Typechecking: 1.36s&#xA;2024/02/01 20:49:07 [startup:3] Evaluation: 0.01s&#xA;2024/02/01 20:49:07 [startup:3] Typechecking: 0.02s&#xA;2024/02/01 20:49:07 [startup:3] Evaluation: 0.00s&#xA;2024/02/01 20:49:07 [startup:3] Typechecking: 0.00s&#xA;2024/02/01 20:49:07 [startup:3] Evaluation: 0.00s&#xA;2024/02/01 20:49:07 [startup:3] Typechecking: 0.00s&#xA;2024/02/01 20:49:07 [startup:3] Evaluation: 0.08s&#xA;2024/02/01 20:49:07 [startup:3] Loaded /etc/liquidsoap/index.liq: 0.08s&#xA;2024/02/01 20:49:07 [64_aac:3] Content type is {audio=pcm(stereo)}.&#xA;2024/02/01 20:49:07 [cross:3] Content type is {audio=pcm(stereo)}.&#xA;2024/02/01 20:49:07 [on_track:3] Content type is {audio=pcm(stereo)}.&#xA;2024/02/01 20:49:07 [promos.2:3] Content type is {audio=pcm(stereo)}.&#xA;2024/02/01 20:49:07 [promos:3] Content type is {}.&#xA;2024/02/01 20:49:07 [current:3] Content type is {audio=pcm(stereo)}.&#xA;2024/02/01 20:49:07 [music.3:3] Content type is {audio=pcm(stereo)}.&#xA;2024/02/01 20:49:07 [music.2:3] Content type is {}.&#xA;2024/02/01 20:49:07 [music:3] Content type is {audio=pcm(stereo)}.&#xA;2024/02/01 20:49:07 [safe_blank:3] Content type is {audio=pcm(stereo)}.&#xA;2024/02/01 20:49:07 [clock.main:3] Streaming loop starts in auto-sync mode&#xA;2024/02/01 20:49:07 [clock.main:3] Delegating synchronization to CPU clock&#xA;2024/02/01 20:49:07 [video.converter:3] Using preferred video converter: ffmpeg.&#xA;2024/02/01 20:49:07 [audio.converter:3] Using samplerate converter: libsamplerate.&#xA;2024/02/01 20:49:07 [video.text:3] Using sdl implementation&#xA;2024/02/01 20:49:07 [mksafe:3] Switch to safe_blank.&#xA;2024/02/01 20:49:07 [clock.main:2] Source 64_aac failed while streaming: Lang.Runtime_error { kind: "encoder", msg: "Invalid configuration: aot", pos: [at /etc/liquidsoap/index.liq, line 52, char 2-144] }!&#xA;2024/02/01 20:49:07 [clock.main:2] Raised at Liquidsoap_lang__Runtime_error.raise in file "src/lang/runtime_error.ml", line 48, characters 14-21&#xA;2024/02/01 20:49:07 [clock.main:2] Called from Stdlib__List.iter in file "list.ml", line 110, characters 12-15&#xA;2024/02/01 20:49:07 [clock.main:2] Called from Fdkaac_encoder.create_encoder in file "src/core/encoder/encoders/fdkaac_encoder.ml", line 69, characters 2-22&#xA;2024/02/01 20:49:07 [clock.main:2] Called from Fdkaac_encoder.encoder in file "src/core/encoder/encoders/fdkaac_encoder.ml", line 73, characters 12-35&#xA;2024/02/01 20:49:07 [clock.main:2] Called from Encoder.get_factory.(fun) in file "src/core/encoder/encoder.ml", line 344, characters 8-32&#xA;2024/02/01 20:49:07 [clock.main:2] Called from Icecast2.output#icecast_start in file "src/core/outputs/icecast2.ml", line 555, characters 16-67&#xA;2024/02/01 20:49:07 [clock.main:2] Called from Icecast2.output#send in file "src/core/outputs/icecast2.ml", line 544, characters 12-30&#xA;2024/02/01 20:49:07 [clock.main:2] Called from Output.encoded#send_frame.output_chunks.f in file "src/core/outputs/output.ml", line 256, characters 10-24&#xA;2024/02/01 20:49:07 [clock.main:2] Called from Output.output#output in file "src/core/outputs/output.ml", line 192, characters 45-70&#xA;2024/02/01 20:49:07 [clock.main:2] Called from Clock.MkClock.clock#end_tick.(fun) in file "src/core/clock.ml", line 318, characters 16-24&#xA;Incorrect BOM value&#xA;Error reading lyrics, skipped&#xA;2024/02/01 20:49:07 [clock.main:2]&#xA;[mp3 @ 0x7fd5ad428000] Estimating duration from bitrate, this may be inaccurate&#xA;2024/02/01 20:49:07 [decoder.ffmpeg:3] Requested content-type for "/data/dropbox/promos/current/24-7 promo 1 remix.mp3": {audio=pcm(stereo)}&#xA;2024/02/01 20:49:07 [decoder.ffmpeg:3] FFmpeg recognizes "/data/dropbox/promos/current/24-7 promo 1 remix.mp3" as audio: {codec: mp3, 44100Hz, 2 channel(s)}&#xA;2024/02/01 20:49:07 [decoder.ffmpeg:3] Decoded content-type for "/data/dropbox/promos/current/24-7 promo 1 remix.mp3": {audio=pcm(stereo)}&#xA;2024/02/01 20:49:07 [decoder.ffmpeg:3] Requested content-type for "/data/music/Bruno Mars - Locked out of Heaven.mp3": {audio=pcm(stereo)}&#xA;2024/02/01 20:49:07 [decoder.ffmpeg:3] FFmpeg recognizes "/data/music/Bruno Mars - Locked out of Heaven.mp3" as audio: {codec: mp3, 44100Hz, 2 channel(s)}, video: {codec: mjpeg, 640x640, yuvj444p}, video_2: {codec: mjpeg, 640x640, yuvj444p}&#xA;2024/02/01 20:49:07 [decoder.ffmpeg:3] Decoded content-type for "/data/music/Bruno Mars - Locked out of Heaven.mp3": {audio=pcm(stereo)}&#xA;Incorrect BOM value&#xA;Error reading lyrics, skipped&#xA;[mp3 @ 0x7fd5ad428000] Estimating duration from bitrate, this may be inaccurate&#xA;2024/02/01 20:49:07 [clock.main:3] Streaming loop stopped.&#xA;2024/02/01 20:49:07 [threads:3] Main loop exited&#xA;2024/02/01 20:49:07 [main:3] Shutdown started!&#xA;2024/02/01 20:49:07 [threads:3] Waiting for main threads to terminate...&#xA;2024/02/01 20:49:07 [threads:3] Main threads terminated.&#xA;2024/02/01 20:49:07 [threads:3] Shutting down scheduler...&#xA;2024/02/01 20:49:07 [threads:3] Scheduler shut down.&#xA;2024/02/01 20:49:07 [main:3] Cleaning downloaded files...&#xA;2024/02/01 20:49:07 [main:3] Freeing memory...&#xA;2024/02/01 20:49:07 >>> LOG END&#xA;

    &#xA;

    EDIT it does seem to be using video, which wouldn't help ? Looking at this bit :

    &#xA;

    2024/02/01 20:49:07 [frame:3] Using 44100Hz audio, 25Hz video, 44100Hz main.&#xA;2024/02/01 20:49:07 [frame:3] Video frame size set to: 1280x720&#xA;

    &#xA;

    But no idea why or how to stop that...

    &#xA;

  • ffmpeg drawtext Arabic fonts doesn't render correctly [closed]

    11 février, par Mahmoud Abdellatief

    what i'm trying to achieve :&#xA;loop an image into a video and overlay Arabic Text from the Qur'an on it including the text diacritical mark, using a custom font.

    &#xA;

    example of the text to be rendered :

    &#xA;

    بِسْمِ ٱللَّهِ ٱلرَّحْمَـٰنِ ٱلرَّحِيمِ&#xA;

    &#xA;

    the font used :&#xA;https://fonts.qurancomplex.gov.sa/wp02/wp-content/uploads/2024/01/UthmanicHafs_v22.zip

    &#xA;

    font's unicode module :

    &#xA;

    Unicode Module &#xA; &#xA;The Research and Development Unit in the Computer Department at King Fahd Glorious Qur’an Printing Complex relied on the unicode system unicode to create (Hafs) font in the Uthmanic Script, because this system is followed globally among computer and systems manufacturing companies in the world.&#xA;&#xA;Unicode organization is a global code group that is used to define all codes and letters used in most of the world&#x27;s languages and gathered in one code to facilitate the presentation and delivery on information despite of the language used. This global coding uses 1 to 4 bytes (byte = 8 bits) to encode letters, and so far only a third of the number available in Unicode organization to encode the letters of these languages.&#xA;&#xA;Taking into account Hafs font with the Uthmanic Script, which was built entirely on the unicode system. We can explore the basic letters that were formed according to the following figure:&#xA;&#xA;Whereas the font was developed starting from code (0600 ) to code (066FF ) Taking into account there are several encoded letters that haven&#x27;t been used at all so it was replaces with the code []. The displayed copy above is the one that is been developed from the basic Arabic coding (0600-06FF) which was updated by Unicode organization in 2009.&#xA;

    &#xA;

    expected result :&#xA;exported video with correctly rendered text using the given font.

    &#xA;

    actual result :&#xA;the text rendered contains only the diacritical marks ( which are the accents on top of the letters ) without the actual letters.&#xA;actual result

    &#xA;

    what i tried :&#xA;this is my test command which exports just an image for faster results :

    &#xA;

    Ffmpeg -loop 1  -i "image-2.jpg" -vf "drawtext=text=&#x27;بِسْمِ ٱللَّهِ ٱلرَّحْمَـٰنِ ٱلرَّحِيمِ&#x27;:fontsize=124:fontcolor=white:fontfile=&#x27;UthmanicHafsV22.ttf&#x27;:x=(w-text_w)/2:y=(h-text_h)/2" -frames:v 1  "output.png"&#xA;

    &#xA;

      &#xA;
    • tried adding ft_load_flags , almost tried all of them
    • &#xA;

    • tried text_shaping=1 , with no success
    • &#xA;

    • tried textfile instead of text
    • &#xA;

    • tried changing the font, any font i try with it always have different problems, either some squares instead of the diacritical mark
    • &#xA;

    &#xA;

    p.s im having same results on both latest ffmpeg compiled by myself on macos terminal with all required libraries enabled , and also on flutter ffmpeg kit full gpl

    &#xA;