Recherche avancée

Médias (3)

Mot : - Tags -/collection

Autres articles (112)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Librairies et binaires spécifiques au traitement vidéo et sonore

    31 janvier 2010, par

    Les logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
    Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
    Binaires complémentaires et facultatifs flvtool2 : (...)

Sur d’autres sites (17046)

  • ffmpeg trouble with NetMaui and Android [closed]

    15 juin 2024, par Billy Vanegas

    I find myself in a following predicament. While I work with Visual Studio 2022, ffmpeg performs flawlessly on Windows platform. However, I'm encountering difficulties when attempting to replicate this functionality on Android. Despite exploring NuGet packages like FFMpegCore, which seem to be ffmpeg wrappers but lack ffmpeg itself, I'm still struggling to find a clear path forward. I've even tried integrating ffmpeg-kit for Android as per the instructions, only to face repeated failures and a sense of confusion. I must admit my puzzlement : why isn't there a straightforward method to seamlessly add ffmpeg to a .NET MAUI project that functions consistently across both iOS and Android platforms ?

    


    I want to convert MP3 files to WAV format using FFmpeg on the Android platform within a .NET MAUI project.

    


    I am using the FFmpegCore library and have downloaded the FFmpeg binaries from the official FFmpeg website. However, I encountered issues when attempting to pass the binary folder on the emulator, when I try to pass it, I get permission denied in working folder :
/data/user/0/com.companyname.projectname/files/ffmpeg on this part of code :

    


             await FFMpegArguments
               .FromFileInput(mp3Path)
               .OutputToFile(wavPath, true, options => options
                   .WithAudioCodec("pcm_s16le")
                   .WithAudioSamplingRate(44100)
                   .WithAudioBitrate(320000)
                   )
               .ProcessAsynchronously();


    


    This is the AndroidManifest.xml

    


    &lt;?xml version="1.0" encoding="utf-8"?>&#xA;<manifest>&#xA;    <application></application>&#xA;    &#xA;    &#xA;    &#xA;    &#xA;</manifest>&#xA;

    &#xA;

     private async Task ConvertMp3ToWav(string mp3Path, string wavPath)&#xA; {&#xA;     try&#xA;     {&#xA;         var directory = Path.GetDirectoryName(wavPath);&#xA;         if (!Directory.Exists(directory))&#xA;             Directory.CreateDirectory(directory!);&#xA;         if (!File.Exists(wavPath))&#xA;             Console.WriteLine($"File not found {wavPath}, creating empty file.");&#xA;             using var fs = new FileStream(wavPath, FileMode.CreateNew);&#xA;         if (!File.Exists(mp3Path))&#xA;             Console.WriteLine($"File not found {mp3Path}");&#xA;&#xA;         string? ffmpegBinaryPath = await ExtractFFmpegBinaries(Platform.AppContext);&#xA;         FFMpegCore.GlobalFFOptions.Configure(new FFOptions { BinaryFolder = Path.GetDirectoryName(ffmpegBinaryPath!)! });&#xA;&#xA;         await FFMpegArguments&#xA;               .FromFileInput(mp3Path)&#xA;               .OutputToFile(wavPath, true, options => options&#xA;                   .WithAudioCodec("pcm_s16le")&#xA;                   .WithAudioSamplingRate(44100)&#xA;                   .WithAudioBitrate(320000)&#xA;                   )&#xA;               .ProcessAsynchronously();&#xA;     }&#xA;     catch (Exception ex)&#xA;     {&#xA;         Console.WriteLine($"An error occurred during the conversion process: {ex.Message}");&#xA;         throw;&#xA;     }&#xA; }&#xA;

    &#xA;

        private async Task<string> ExtractFFmpegBinaries(Context context)&#xA;    {&#xA;        var architectureFolder = "x86"; // "armeabi-v7a";&#xA;        var ffmpegBinaryName = "ffmpeg"; &#xA;        var ffmpegBinaryPath = Path.Combine(context.FilesDir!.AbsolutePath, ffmpegBinaryName);&#xA;        var tempFFMpegFileName = Path.Combine(FileSystem.AppDataDirectory, ffmpegBinaryName);&#xA;&#xA;        if (!File.Exists(ffmpegBinaryPath))&#xA;        {&#xA;            try&#xA;            {&#xA;                var assetPath = $"Libs/{architectureFolder}/{ffmpegBinaryName}";&#xA;                using var assetStream = context.Assets!.Open(assetPath);&#xA;               &#xA;                await using var tempFFMpegFile = File.OpenWrite(tempFFMpegFileName);&#xA;                await assetStream.CopyToAsync(tempFFMpegFile);&#xA;&#xA;                //new MainActivity().RequestStoragePermission();&#xA;                Java.Lang.Runtime.GetRuntime()!.Exec($"chmod 755 {tempFFMpegFileName}");&#xA;            }&#xA;            catch (Exception ex)&#xA;            {&#xA;                Console.WriteLine($"An error occurred while extracting FFmpeg binaries: {ex.Message}");&#xA;                throw;&#xA;            }&#xA;        }&#xA;        else&#xA;        {&#xA;            Console.WriteLine($"FFmpeg binaries already extracted to: {ffmpegBinaryPath}");&#xA;        }&#xA;&#xA;        return tempFFMpegFileName!;&#xA;    }&#xA;</string>

    &#xA;

  • Problems with Python's azure.cognitiveservices.speech when installing together with FFmpeg in a Linux web app

    15 mai 2024, par Kakobo kakobo

    I need some help.&#xA;I'm building an web app that takes any audio format, converts into a .wav file and then passes it to 'azure.cognitiveservices.speech' for transcription.I'm building the web app via a container Dockerfile as I need to install ffmpeg to be able to convert non ".wav" audio files to ".wav" (as azure speech services only process wav files). For some odd reason, the 'speechsdk' class of 'azure.cognitiveservices.speech' fails to work when I install ffmpeg in the web app. The class works perfectly fine when I install it without ffpmeg or when i build and run the container in my machine.

    &#xA;

    I have placed debug print statements in the code. I can see the class initiating, for some reason it does not buffer in the same when when running it locally in my machine. The routine simply stops without any reason.

    &#xA;

    Has anybody experienced a similar issue with azure.cognitiveservices.speech conflicting with ffmpeg ?

    &#xA;

    Here's my Dockerfile :

    &#xA;

    # Use an official Python runtime as a parent imageFROM python:3.11-slim&#xA;&#xA;#Version RunRUN echo "Version Run 1..."&#xA;&#xA;Install ffmpeg&#xA;&#xA;RUN apt-get update &amp;&amp; apt-get install -y ffmpeg &amp;&amp; # Ensure ffmpeg is executablechmod a&#x2B;rx /usr/bin/ffmpeg &amp;&amp; # Clean up the apt cache by removing /var/lib/apt/lists saves spaceapt-get clean &amp;&amp; rm -rf /var/lib/apt/lists/*&#xA;&#xA;//Set the working directory in the container&#xA;&#xA;WORKDIR /app&#xA;&#xA;//Copy the current directory contents into the container at /app&#xA;&#xA;COPY . /app&#xA;&#xA;//Install any needed packages specified in requirements.txt&#xA;&#xA;RUN pip install --no-cache-dir -r requirements.txt&#xA;&#xA;//Make port 80 available to the world outside this container&#xA;&#xA;EXPOSE 8000&#xA;&#xA;//Define environment variable&#xA;&#xA;ENV NAME World&#xA;&#xA;//Run main.py when the container launches&#xA;&#xA;CMD ["streamlit", "run", "main.py", "--server.port", "8000", "--server.address", "0.0.0.0"]`and here&#x27;s my python code:&#xA;

    &#xA;

    def transcribe_audio_continuous_old(temp_dir, audio_file, language):&#xA;    speech_key = azure_speech_key&#xA;    service_region = azure_speech_region&#xA;&#xA;    time.sleep(5)&#xA;    print(f"DEBUG TIME BEFORE speechconfig")&#xA;&#xA;    ran = generate_random_string(length=5)&#xA;    temp_file = f"transcript_key_{ran}.txt"&#xA;    output_text_file = os.path.join(temp_dir, temp_file)&#xA;    speech_recognition_language = set_language_to_speech_code(language)&#xA;    &#xA;    speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)&#xA;    speech_config.speech_recognition_language = speech_recognition_language&#xA;    audio_input = speechsdk.AudioConfig(filename=os.path.join(temp_dir, audio_file))&#xA;        &#xA;    speech_recognizer = speechsdk.SpeechRecognizer(speech_config=speech_config, audio_config=audio_input, language=speech_recognition_language)&#xA;    done = False&#xA;    transcript_contents = ""&#xA;&#xA;    time.sleep(5)&#xA;    print(f"DEBUG TIME AFTER speechconfig")&#xA;    print(f"DEBUG FIle about to be passed {audio_file}")&#xA;&#xA;    try:&#xA;        with open(output_text_file, "w", encoding=encoding) as file:&#xA;            def recognized_callback(evt):&#xA;                print("Start continuous recognition callback.")&#xA;                print(f"Recognized: {evt.result.text}")&#xA;                file.write(evt.result.text &#x2B; "\n")&#xA;                nonlocal transcript_contents&#xA;                transcript_contents &#x2B;= evt.result.text &#x2B; "\n"&#xA;&#xA;            def stop_cb(evt):&#xA;                print("Stopping continuous recognition callback.")&#xA;                print(f"Event type: {evt}")&#xA;                speech_recognizer.stop_continuous_recognition()&#xA;                nonlocal done&#xA;                done = True&#xA;            &#xA;            def canceled_cb(evt):&#xA;                print(f"Recognition canceled: {evt.reason}")&#xA;                if evt.reason == speechsdk.CancellationReason.Error:&#xA;                    print(f"Cancellation error: {evt.error_details}")&#xA;                nonlocal done&#xA;                done = True&#xA;&#xA;            speech_recognizer.recognized.connect(recognized_callback)&#xA;            speech_recognizer.session_stopped.connect(stop_cb)&#xA;            speech_recognizer.canceled.connect(canceled_cb)&#xA;&#xA;            speech_recognizer.start_continuous_recognition()&#xA;            while not done:&#xA;                time.sleep(1)&#xA;                print("DEBUG LOOPING TRANSCRIPT")&#xA;&#xA;    except Exception as e:&#xA;        print(f"An error occurred: {e}")&#xA;&#xA;    print("DEBUG DONE TRANSCRIPT")&#xA;&#xA;    return temp_file, transcript_contents&#xA;

    &#xA;

    The transcript this callback works fine locally, or when installed without ffmpeg in the linux web app. Not sure why it conflicts with ffmpeg when installed via container dockerfile. The code section that fails can me found on note #NOTE DEBUG"

    &#xA;

  • Podcast Producer 2 REST api

    11 septembre 2009

    I’ve been working on documenting the REST api that PCP2 uses for client server communication as part of a new project. I thought it might be useful to other folks. Consider this a work in progress - I’ve only documented the workflow for doing a multisource recording so far. Follow the job for the info.

    Each section gives a sample command and a sample response.

    All pages are behind basic HTTP auth.

    General sequence of events

    * get workflow list
    * get cameras
    * request status for camera (including thumbnail)
    * start cameras
    * create recording enclosure
    * stop cameras, provide submission_UUID returned by above step, include title


    *URL : https://pcpserver:8170/podcastproducer/info

    *Type : GET

    *Content : version=2

    *Response :
    <pre>
    <podcast_producer_result>
    <action>index</action>
    <status>success</status>
    <plist version="1.0">
    <dict>
    <key>server_version</key>
    <string>2.0</string>
    <key>http_auth_type</key>
    <array>
    <string>basic</string>
    <string>digest</string>
    <string>kerberos</string>
    </array>
    <key>krb_service_principals</key>
    <array>
    <string>pcast/x101-186-103-dhcp.cla.umn.edu@X101-186-103-DHCP.CLA.UMN.EDU</string>
    </array>
    <key>server_uuid</key>
    <string>DB31DA49-10AE-472C-B3B9-86A8F8112399</string>
    <key>cluster_members</key>
    <dict>
    <key>F1021B98-7E7E-44FB-8EB1-E0DA1885D5BA</key>
    <dict>
    <key>date_added</key>
    <string>Tue Sep 01 10:23:49 -0500 2009</string>
    <key>last_update</key>
    <string>Tue Sep 08 10:35:17 -0500 2009</string>
    <key>server_host</key>
    <string>x101-186-103-dhcp.cla.umn.edu</string>
    <key>server_port</key>
    <string>8170</string>
    <key>tunnel_agent_host</key>
    <string>x101-186-103-dhcp.cla.umn.edu</string>
    <key>tunnel_agent_port</key>
    <string>8175</string>
    <key>network_addrs</key>
    <array>
    <string>128.101.186.103</string>
    </array>
    </dict>
    </dict>
    </dict>
    </plist>
    </podcast_producer_result>
    </pre>


    * URL : https://pcpserver:8170/podcastproducer/workflows
    * Type : GET
    * Content : version=2&language=en
    * Response :
    <pre>
    <podcast_producer_result>
    <action>index</action>
    <status>success</status>
    <results>OK</results>
    <plist version="1.0">
    <dict>
    <key>user_fullname</key>
    <string>podcast</string>
    <key>user_shortname</key>
    <string>podcast</string>
    <key>workflows</key>
    <array>
    <dict>
    <key>name</key>
    <string>Montage</string>
    <key>title</key>
    <string>Montage</string>
    <key>description</key>
    <string>Montage workflow</string>
    <key>uuid</key>
    <string>F797D54D-1539-42AA-B6AC-3CB3A4C15EF5</string>
    <key>version</key>
    <string>2.0</string>
    <key>editor</key>
    <string>Podcast Composer</string>
    <key>sources</key>
    <array>
    <dict>
    <key>contentTypes</key>
    <array>
    <string>com.apple.quicktime-movie</string>
    <string>com.adobe.pdf</string>
    <string>com.apple.iwork.keynote.key</string>
    <string>com.apple.iwork.pages.pages</string>
    <string>org.openxmlformats.wordprocessingml.document</string>
    <string>com.microsoft.word.doc</string>
    <string>org.openxmlformats.presentationml.presentation</string>
    <string>com.microsoft.powerpoint.ppt</string>
    <string>com.microsoft.bmp</string>
    <string>com.compuserve.gif</string>
    <string>public.jpeg-2000</string>
    <string>public.jpeg</string>
    <string>com.adobe.pdf</string>
    <string>com.apple.pict</string>
    <string>public.png</string>
    <string>com.adobe.photoshop-image</string>
    <string>com.sgi.sgi-image</string>
    <string>com.truevision.tga-image</string>
    <string>public.tiff</string>
    </array>
    <key>description</key>
    <string>Any Document</string>
    <key>isFolder</key>
    <true/>
    <key>isOptional</key>
    <false/>
    <key>sourceTypes</key>
    <array>
    <string>File</string>
    </array>
    </dict>
    </array>
    <key>user_requirements</key>
    <array>
    <string>Title</string>
    <string>Description</string>
    </array>
    <key>access_control_entries</key>
    <array>
    </array>
    </dict>
    <dict>
    <key>name</key>
    <string>Single Source</string>
    <key>title</key>
    <string>Single Source</string>
    <key>description</key>
    <string>Single Source workflow</string>
    <key>uuid</key>
    <string>DEFA1587-A650-426E-92DA-01C5EB811705</string>
    <key>version</key>
    <string>2.0</string>
    <key>editor</key>
    <string>Podcast Composer</string>
    <key>sources</key>
    <array>
    <dict>
    <key>contentTypes</key>
    <array>
    <string>com.apple.quicktime-movie</string>
    </array>
    <key>description</key>
    <string>Any Video</string>
    <key>isFolder</key>
    <false/>
    <key>isOptional</key>
    <false/>
    <key>sourceTypes</key>
    <array>
    <string>Video</string>
    <string>Screen</string>
    <string>Audio</string>
    <string>File</string>
    </array>
    </dict>
    </array>
    <key>user_requirements</key>
    <array>
    <string>Title</string>
    <string>Description</string>
    </array>
    <key>access_control_entries</key>
    <array>
    </array>
    </dict>
    </array>
    </dict>
    </plist>
    </podcast_producer_result>
    </pre>
    ----

    * URL : https://pcpserver:8170/podcastproducer/cameras
    * Type : GET
    * Content : version=2
    * Response :
    <pre>
    <podcast_producer_result>
    <action>index</action>
    <status>success</status>
    <plist version="1.0">
    <dict>
    <key>cameras</key>
    <array>
    <dict>
    <key>name</key>
    <string>150-A Camera</string>
    <key>uuid</key>
    <string>307682A5-B552-4AFA-B7E2-3811D772C9A1</string>
    <key>connected_to_member_uuid</key>
    <string>F1021B98-7E7E-44FB-8EB1-E0DA1885D5BA</string>
    <key>in_use</key>
    <string>false</string>
    <key>recording_status</key>
    <string>online</string>
    <key>preview_url</key>
    <string>https://x101-186-103-dhcp.cla.umn.edu:8170/podcastproducer/previews/307682A5-B552-4AFA-B7E2-3811D772C9A1.jpg</string> ;
    <key>access_control_entries</key>
    <array>
    </array>
    </dict>
    <dict>
    <key>name</key>
    <string>150-A Epiphan</string>
    <key>uuid</key>
    <string>CE610AB0-CA50-49EB-8FFE-78E57CDCA550</string>
    <key>connected_to_member_uuid</key>
    <string>F1021B98-7E7E-44FB-8EB1-E0DA1885D5BA</string>
    <key>in_use</key>
    <string>false</string>
    <key>recording_status</key>
    <string>online</string>
    <key>preview_url</key>
    <string>https://x101-186-103-dhcp.cla.umn.edu:8170/podcastproducer/previews/CE610AB0-CA50-49EB-8FFE-78E57CDCA550.jpg</string> ;
    <key>access_control_entries</key>
    <array>
    </array>
    </dict>
    </array>
    </dict>
    </plist>
    </podcast_producer_result>
    </pre>


    * URL : https://pcpserver:8170/podcastproducer/cameras/start
    * Type : POST
    * Content : action=pause&version=2&camera_name=150-A%20Camera&controller=cameras
    * Response :
    <pre>
    <podcast_producer_result>
    <action>start</action>
    <status>success</status>
    <results>OK</results>
    </podcast_producer_result>
    </pre>


    * URL : https://pcpserver:8170/podcastproducer/cameras/status
    * Type : POST
    * Content : delay=0&action=start&version=2&camera_name=150-A%20Epiphan&controller=cameras
    * Response :
    <pre><podcast_producer_result>
    <action>status</action>
    <status>success</status>
    <results>OK</results>
    <plist version="1.0">
    <dict>
    <key>preview</key>
    <string>https://x101-186-103-dhcp.cla.umn.edu:8170/podcastproducer/previews/307682A5-B552-4AFA-B7E2-3811D772C9A1.jpg</string> ;
    <key>preview_image_data</key>
    <string>RAW JPEG DATA RAW JPEG DATA RAW JPEG DATA RAW JPEG DATA RAW JPEG DATA</string>
    <key>recording_status</key>
    <string>online</string>
    <key>started_at</key>
    <string>Tue Sep 08 09:31:40 -0500 2009</string>
    <key>stopped_at</key>
    <string>Tue Sep 08 09:32:10 -0500 2009</string>
    <key>elapsed</key>
    <string>41</string>
    <key>last_error</key>
    <string>805306368</string>
    </dict>
    </plist>
    </podcast_producer_result>
    </pre>


    * URL : https://pcpserver:8170/podcastproducer/cameras/pause
    * Type : POST
    * Content : action=pause&version=2&camera_name=150-A%20Camera&controller=cameras
    * Response :
    <pre><podcast_producer_result>
    <action>status</action>
    <status>success</status>
    <results>OK</results>
    <plist version="1.0">
    <dict>
    <key>preview</key>
    <string>https://x101-186-103-dhcp.cla.umn.edu:8170/podcastproducer/previews/307682A5-B552-4AFA-B7E2-3811D772C9A1.jpg</string> ;
    <key>recording_status</key>
    <string>online</string>
    <key>started_at</key>
    <string>Tue Sep 08 09:31:40 -0500 2009</string>
    <key>stopped_at</key>
    <string>Tue Sep 08 09:32:10 -0500 2009</string>
    <key>elapsed</key>
    <string>41</string>
    <key>last_error</key>
    <string>805306368</string>
    </dict>
    </plist>
    </podcast_producer_result></pre>


    * URL : https://pcpserver:8170/podcastproducer/cameras/stop
    * Type : POST
    * Content : workflow_name=&UserMetadata_Description=&submission_uuid=7497E3AC-0A75-4C7C-8C66-26294C9274FE&action=stop&version=2&camera_name=150-A%20Epiphan&controller=cameras&UserMetadata_Title=Test123
    * Response :
    <pre><podcast_producer_result>
    <action>stop</action>
    <status>success</status>
    <results>OK</results>
    </podcast_producer_result>
    </pre>


    * URL : https://pcpserver:8170/podcastproducer/recordings/create
    * Type : POST
    * Content : version=2&workflow_uuid=C6EF52A7-04E3-477D-9F38-6B61F108D7B9
    * Response :
    <pre>
    <podcast_producer_result>
    <action>create</action>
    <status>success</status>
    <results>OK</results>
    <plist version="1.0">
    <dict>
    <key>workflow_uuid</key>
    <string>C6EF52A7-04E3-477D-9F38-6B61F108D7B9</string>
    <key>recording_uuid</key>
    <string>FD5A1459-F7CE-41FA-8155-049DF774298B</string>
    <key>submission_uuids</key>
    <array>
    <string>A626D8E4-E439-4E57-9982-DB4BD035CB41</string>
    <string>CFBCCB74-A41F-42D3-BEAA-58165B1116C6</string>
    </array>
    </dict>
    </plist>
    </podcast_producer_result>
    </pre>