Recherche avancée

Médias (2)

Mot : - Tags -/map

Autres articles (64)

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

Sur d’autres sites (10173)

  • avcodec/mpeg2dec : Fix motion vector rounding for chroma components

    11 février 2018, par Nekopanda
    avcodec/mpeg2dec : Fix motion vector rounding for chroma components
    

    In 16x8 motion compensation, for lower 16x8 region, the input to mpeg_motion() for motion_y was "motion_y + 16", which causes wrong rounding. For 4:2:0, chroma scaling for y is dividing by two and rounding toward zero. When motion_y < 0 and motion_y + 16 > 0, the rounding direction of "motion_y" and "motion_y + 16" is different and rounding "motion_y + 16" would be incorrect.

    We should input "motion_y" as is to round correctly. I add "is_16x8" flag to do that.

    Signed-off-by : Michael Niedermayer <michael@niedermayer.cc>

    • [DH] libavcodec/mpegvideo_motion.c
    • [DH] tests/ref/fate/filter-mcdeint-fast
    • [DH] tests/ref/fate/filter-mcdeint-medium
    • [DH] tests/ref/fate/filter-w3fdif-complex
    • [DH] tests/ref/fate/filter-w3fdif-simple
    • [DH] tests/ref/fate/filter-yadif-mode0
    • [DH] tests/ref/fate/filter-yadif-mode1
    • [DH] tests/ref/fate/filter-yadif10
    • [DH] tests/ref/fate/filter-yadif16
    • [DH] tests/ref/fate/mpeg2-field-enc
    • [DH] tests/ref/fate/mpeg2-ticket6677
  • 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;

  • javacv and moviepy comparison for video generation

    15 septembre 2024, par Vikram

    I am trying to generate video using images, where image have some overlays text and png icons. I am using javacv library for this.&#xA;Final output video seems pixelated, i don't understand what is it since i do not have video processing domain knowledge, i am beginner to this.&#xA;I know that video bitrate and choice of video encoder are important factor which contributes to video quality and there are many more factors too.

    &#xA;

    I am providing you two output for comparison, one of them is generated using javacv and another one is from moviepy library

    &#xA;

    Please watch it in full screen since the problem i am talking about only gets highlighted in full screen, you will see the pixel dancing in javacv generated video, but python output seems stable

    &#xA;

    https://imgur.com/a/aowNnKg - javacv generated

    &#xA;

    https://imgur.com/a/eiLXrbk - Moviepy generated

    &#xA;

    I am using same encoder in both of the implementation

    &#xA;

    Encoder - libx264&#xA;bitrate - &#xA;   800 Kbps for javacv &#xA;   500 Kbps for moviepy&#xA;&#xA;frame rate - 24fps for both of them&#xA;&#xA;output video size -> &#xA;    7MB (javacv)&#xA;    5MB (Moviepy)&#xA;&#xA;&#xA;

    &#xA;

    generated output size from javacv is bigger then moviepy generated video.

    &#xA;

    here is my java configuration for FFmpegFrameRecorder

    &#xA;

            FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(this.outputPath, &#xA;                                           this.screensizeX, this.screensizeY);&#xA;        if(this.videoCodecName!=null &amp;&amp; "libx264".equals(this.videoCodecName)) {&#xA;            recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);&#xA;        }&#xA;        recorder.setFormat("mp4"); &#xA;        recorder.setPixelFormat(avutil.AV_PIX_FMT_YUV420);&#xA;        recorder.setVideoBitrate(800000);&#xA;        recorder.setImageWidth(this.screensizeX);&#xA;        recorder.setFrameRate(24);&#xA;&#xA;

    &#xA;

    and here is python configuration for writing video file

    &#xA;

    Full_final_clip.write_videofile(&#xA;                            f"{video_folder_path}/{FILE_ID}_INTERMEDIATE.mp4",&#xA;                            codec="libx264",&#xA;                            audio_codec="aac",&#xA;                            temp_audiofile=f"{FILE_ID}_INTER_temp-audio.m4a",&#xA;                            remove_temp=True,&#xA;                            fps=24,&#xA;                        )&#xA;&#xA;

    &#xA;

    as you can see i am not specifying bitrate in python, but i checked that bitrate of final output is around 500 kbps, which is lower then what i specified in java, yet java generated video quality seems poor.

    &#xA;

    I have tried setting crf value also , but it seems it does not have any impact when used.

    &#xA;

    increasing bitrate improve quality somewhat but at the cost of file size, still generated output seems pixelated.

    &#xA;

    Can someone please highlight what might be the issue, and how python is generating better quality video, when both of the libraries use ffmpeg at the backend.

    &#xA;

    Edit 1 : also, I am adding code which is being used to make zoom animation for continuous frames, As somewhere i read that this might be the cause for pixel jitter, please see and let me know if there is any improvement we can do to remove pixel jittering

    &#xA;

    private Mat applyZoomEffect(Mat frame, int currentFrame, long effectFrames, int width, int height, String mode, String position, double speed) {&#xA;        long totalFrames = effectFrames;&#xA;        double i = currentFrame;&#xA;        if ("out".equals(mode)) {&#xA;            i = totalFrames - i;&#xA;        }&#xA;        double zoom = 1 &#x2B; (i * ((0.1 * speed) / totalFrames));&#xA;&#xA;        double originalCenterX = width/2.0;&#xA;        double originalCenterY = height/2.0;&#xA;   &#xA;&#xA;        // Resize image&#xA;        //opencv_imgproc.resize(frame, resizedMat, new Size(newWidth, newHeight));&#xA;&#xA;        // Determine crop region based on position&#xA;        double x = 0, y = 0;&#xA;        switch (position.toLowerCase()) {&#xA;            case "center":&#xA;                // Adjusting for center zoom&#xA;                 x = originalCenterX - originalCenterX * zoom;&#xA;                 y = originalCenterY - originalCenterY * zoom;&#xA;                 &#xA;                 x= (width-(width*zoom))/2.0;&#xA;                 y= (height-(height*zoom))/2.0;&#xA;                break;&#xA;        }&#xA;&#xA;        double[][] rowData = {{zoom, 0, x},{0,zoom,y}};&#xA;&#xA;        double[] flatData = flattenArray(rowData);&#xA;&#xA;        // Create a DoublePointer from the flattened array&#xA;        DoublePointer doublePointer = new DoublePointer(flatData);&#xA;&#xA;        // Create a Mat object with two rows and three columns&#xA;        Mat mat = new Mat(2, 3, org.bytedeco.opencv.global.opencv_core.CV_64F); // CV_64F is for double type&#xA;&#xA;        // Put the data into the Mat object&#xA;        mat.data().put(doublePointer);&#xA;        Mat transformedFrame = new Mat();&#xA;        opencv_imgproc.warpAffine(frame, transformedFrame, mat, new Size(frame.cols(), frame.rows()),opencv_imgproc.INTER_LANCZOS4,0,new Scalar(0,0,0,0));&#xA;        return transformedFrame;&#xA;    }&#xA;

    &#xA;