Recherche avancée

Médias (2)

Mot : - Tags -/documentation

Autres articles (87)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Configuration spécifique pour PHP5

    4 février 2011, par

    PHP5 est obligatoire, vous pouvez l’installer en suivant ce tutoriel spécifique.
    Il est recommandé dans un premier temps de désactiver le safe_mode, cependant, s’il est correctement configuré et que les binaires nécessaires sont accessibles, MediaSPIP devrait fonctionner correctement avec le safe_mode activé.
    Modules spécifiques
    Il est nécessaire d’installer certains modules PHP spécifiques, via le gestionnaire de paquet de votre distribution ou manuellement : php5-mysql pour la connectivité avec la (...)

  • 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 (...)

Sur d’autres sites (5080)

  • How to get frame-by-frame audio from the video in python

    7 juin 2023, par Usman Arshad

    So,first of all the description of my program is that I am viewing a video using opencv and whenever I press "p" the video paused for 5 seconds.At last I am saving that updated video in the same directory.I want to add audio to this video and whenever "p" pressed the audio must also be stopped for 5 second until next frame.

    


    import cv2

def save_frames(frames, output_filename, fps):
    # Get video information from the first frame
    height, width, _ = frames[0].shape

    # Create a VideoWriter object to save the frames
    fourcc = cv2.VideoWriter_fourcc(*'mp4v')
    output = cv2.VideoWriter(output_filename, fourcc, fps, (width, height))

    # Write each frame to the video file
    for frame in frames:
        output.write(frame)

    # Release the VideoWriter
    output.release()
    
def main():
    # Load the video
    video_path = 'input_video.mp4'
    cap = cv2.VideoCapture(video_path)


    frames = []
    fps = cap.get(cv2.CAP_PROP_FPS)

    while cap.isOpened():
        # Read the current frame
        ret, frame = cap.read()

        if not ret:
            break

        # Display the frame
        cv2.imshow('Video', frame)

        # Append the frame to the list
        frames.append(frame)
        # Wait for key press
        key = cv2.waitKey(int(1000 / fps))

        if key == ord('p'):
            # Pause the video for 5 seconds
            paused = True
            for _ in range(int(fps * 5)):
                frames.append(frame)
                cv2.waitKey(int(1000 / fps))
            paused = False

    # Release the VideoCapture
    cap.release()

    # Save the frames to a video file
    output_filename = 'output.mp4'
    save_frames(frames, output_filename, fps)

if __name__ == '__main__':
    main()


    


  • Processing .Raw images using ffmpeg or OpenCV

    23 février 2013, par Ahmed Kato

    After reading Wikipedia page of Raw image format which is the digital negative of any image.

    To be viewed or printed, the output from a camera's image sensor has
    to be processed, that is, converted to a photographic rendering of the
    scene, and then stored in a standard raster graphics format such as
    JPEG. This processing, whether done in-camera or later in a raw-file
    converter, involves a number of operations, typically including

    I have some .raw files grabbed from my Logitech c920 using v4l2 example but when I display the image it looks like this :
    raw frame file a raw image where in other frames I can see my shadow

    Does anyone knows how to process such files to see the complete frame ?

    Here is a link to the original .raw file

  • Decoding H.264 stream using FFmpeg on Java

    25 mai 2020, par maru2213

    I'm trying to decode H.264 stream, which is sent over Socket from an Android application to a computer. And I also want to show the decoded stream using JavaFX. I searched much hours, and decided to use JavaCV / FFmpeg. However I got error from FFmpeg. (I was inspired by this code)

    



    Questions :

    



      

    • Why does FFmpeg make error ?
    • 


    • Is it a correct way to convert AVFrame to javafx.scene.image.Image ?
    • 


    



    I'm using :

    



      

    • javacv-platform 1.4.4
    • 


    • ffmpeg-platform 4.1-1.4.4
    • 


    



    Code :

    



    This is a part of import and class fields, and method which runs once at the first time. (Actually the content of initialize() is wrapped by try catch.)

    



        import javafx.scene.image.Image;

    private avcodec.AVCodec avCodec;
    private avcodec.AVCodecContext avCodecContext;
    private avutil.AVDictionary avDictionary;
    private avutil.AVFrame avFrame;

    public void initialize() {
        avCodec = avcodec_find_decoder(AV_CODEC_ID_H264);
        if (avCodec == null) {
            throw new RuntimeException("Can't find decoder");
        }
        avCodecContext = avcodec_alloc_context3(avCodec);
        if (avCodecContext == null) {
            throw new RuntimeException("Can't allocate decoder context");
        }
        int result = avcodec_open2(avCodecContext, avCodec, (AVDictionary) null);
        if (result < 0) {
            throw new RuntimeException("Can't open decoder");
        }
        avFrame = av_frame_alloc();
        if (avFrame == null) {
            throw new RuntimeException("Can't allocate frame");
        }
    }


    



    And this is a method which is called every time when I receive a packet from Android. byte[] data is the packet data starting with 0x00, 0x00, 0x00, 0x01.

    



    The place where I get error is number_of_written_bytes. It always gets <0.

    &#xA;&#xA;

        private void decode(byte[] data) {&#xA;        AVPacket avPacket = new AVPacket();&#xA;        av_init_packet(avPacket);&#xA;        avPacket.pts(AV_NOPTS_VALUE);&#xA;        avPacket.dts(AV_NOPTS_VALUE);&#xA;        BytePointer bytePointer = new BytePointer(data);&#xA;        bytePointer.capacity(data.length);&#xA;        avPacket.data(bytePointer);&#xA;        avPacket.size(data.length);&#xA;        avPacket.pos(-1);&#xA;&#xA;        avcodec_send_packet(avCodecContext, avPacket);&#xA;        int result = avcodec_receive_frame(avCodecContext, avFrame);&#xA;        if (result >= 0) {&#xA;            int bufferOutputSize = av_image_get_buffer_size(avFrame.format(), avFrame.width(), avFrame.height(), 16);&#xA;            Pointer pointer = av_malloc(bufferOutputSize);&#xA;            BytePointer outputPointer = new BytePointer(pointer);&#xA;            int number_of_written_bytes = av_image_copy_to_buffer(outputPointer, bufferOutputSize, avFrame.data(), avFrame.linesize(), avFrame.chroma_location(), avFrame.width(), avFrame.height(), 1);&#xA;            if (number_of_written_bytes &lt; 0) {&#xA;                //The process always come here.&#xA;                throw new RuntimeException("Can&#x27;t copy image to buffer");&#xA;            }&#xA;&#xA;            System.out.println("decode success");&#xA;            Image image = new Image(new ByteArrayInputStream(outputPointer.asBuffer().array()));&#xA;        } else {&#xA;            System.out.println("decode failed");&#xA;        }&#xA;    }&#xA;

    &#xA;