Recherche avancée

Médias (0)

Mot : - Tags -/formulaire

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (49)

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

Sur d’autres sites (5985)

  • subprocess.py returns a File Not Found error

    7 avril 2021, par wasneeplus

    As part of a video analysis script I wanted to find the duration of a video file. For this I found the script offered in the first answer to this question : How to get the duration of a video in Python ?

    


    import subprocess

def get_length(filename):
    result = subprocess.run(["ffprobe", "-v", "error", "-show_entries",
                             "format=duration", "-of",
                             "default=noprint_wrappers=1:nokey=1", filename],
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT)
    return float(result.stdout)


    


    This code works fine when my friend runs it in a Jupyter server environment, but when I try it on my laptop the trouble starts.

    


    When I imput the following filename into the function :

    


    filename = "C:\\Users\\benja\\OneDrive - De Haagse Hogeschool\\Onderzoeken 3\\8V.mp4"


    


    I get the following error :

    


        Traceback (most recent call last):&#xA;  File "c:/Users/benja/OneDrive - De Haagse Hogeschool/Onderzoeken 3/python_script.py", line 9, in <module>&#xA;    num_of_frames = math.floor((pf.get_length(filename) - 1)) * 30&#xA;  File "c:\Users\benja\OneDrive - De Haagse Hogeschool\Onderzoeken 3\python_funcs.py", line 21, in get_length&#xA;    stderr=subprocess.STDOUT)&#xA;  File "C:\Users\benja\Anaconda3\lib\subprocess.py", line 466, in run&#xA;    with Popen(*popenargs, **kwargs) as process:&#xA;  File "C:\Users\benja\Anaconda3\lib\subprocess.py", line 769, in __init__&#xA;    restore_signals, start_new_session)&#xA;  File "C:\Users\benja\Anaconda3\lib\subprocess.py", line 1172, in _execute_child&#xA;    startupinfo)&#xA;FileNotFoundError: [WinError 2] Het systeem kan het opgegeven bestand niet vinden&#xA;</module>

    &#xA;

    I do realise that my problem is almost identical to that of several other questions on here. However, their solutions don't seem to work for me. I have tried to :

    &#xA;

      &#xA;
    • Add the location of ffmpeg-win64-4.2.2.exe to the Path system variable.
    • &#xA;

    • Add the location of python.exe to the ComSpec system variable.
    • &#xA;

    • Put the videofile in the same directory as the script.
    • &#xA;

    &#xA;

    I would be most grateful if someone could point me in the right direction. Thank you in advance.

    &#xA;

  • Android : BitmapFactory.decodeStream() returns null after first success

    27 avril 2014, par giraffe

    My code is intended to update an ImageView with an image from a server when a UI button is pressed.

    The client side code shown below is a Runnable that runs when the button is pressed. The server is a desktop Java application with ffmpeg running in the background, continuously updating image.png with an image from the webcam. When the button is pressed on the Android app, the Android app attempts to receive image.png from the server, and because ffmpeg is constantly updating this image, it should be the most recent image taken with the server’s webcam.

    My problem is that the first button press shows the correct image, but every subsequent button press will just clear out my ImageView. BitmapFactory.decodeStream() is returning null every time I call it after the first time.

    Client side (runs when button is pressed) :

    InputStream inputStream = s.getInputStream();
    img = BitmapFactory.decodeStream(inputStream);          
    jpgView.setImageBitmap(img);        
    jpgView.invalidate();

    Server side :

    ServerSocket sock = new ServerSocket(PORT_NUMBER);
    Socket clientSocket = sock.accept();
    for (;;) {
       File f = new File("C:/folder/image.png");
       FileInputStream fileInput = new FileInputStream(f);
       BufferedInputStream bufferedInput = new BufferedInputStream(fileInput);
       OutputStream outStream = clientSocket.getOutputStream();
       try {
           byte[] outBuffer = new byte[fSize];
           int bRead = bufferedInput.read(outBuffer, 0, outBuffer.length);
           outStream.write(outBuffer, 0, bRead);
           outStream.flush();
           } catch (Exception e) {
               e.printStackTrace();
           } finally {
               bufferedInput.close();
           }
       }
  • FFmpeg - avcodec_receive_frame returns 0 but frames are invalid

    9 juillet 2019, par Jinx

    I’ve been trying to extract images from videos, but not those with PNG codec. My code works fine with those with JPEG. avcodec_receive_frame worked successfully but the data of the frames was like trash ? Do I have to do something special to demuxing when dealing with PNG ?

    Exception thrown at 0x00007FFF7DF34B9A (msvcrt.dll) in Program.exe : 0xC0000005 : Access violation reading location 0x00000000000003F0 when calling avcodec_send_frame in my saveImage function, which means I was accessing invalid or unalloacted memory I guess. How this happened ?

    enter image description here

    Just suppose all the function calls returned 0 until exception thrown.

    Decoding :

    bool ImageExtractor::decode() {
       // some other code here
       ret = avcodec_send_packet(codec_ctx, packet); // returned 0
       ret = avcodec_receive_frame(codec_ctx, frame); // returned 0
       if (ret == 0) {
           if (count >= target_frame) {
               snprintf(buf, sizeof(buf), "%s/%d.png", destination.toLocal8Bit().data(), count);
               saveImage(frame, buf); // a function that writes images on disk
          }
       // some other code here
    }


    bool ImageExtractor::saveImage(AVFrame *frame, char *destination) {
        AVFormatContext *imgFmtCtx = avformat_alloc_context();
        pFormatCtx->oformat = av_guess_format("mjpeg", NULL, NULL);

        // some other code here

       if (!frame)
           std::cout &lt;&lt; "invalid frame \n";

       if (!imgCodecCtx) // AV_CODEC_ID_MJPEG(7)
           std::cout &lt;&lt; "invalid codec ctx \n";

       ret = avcodec_send_frame(imgCodecCtx, frame); // everything stopped here
    }

    Demuxing :

    avformat_open_input(&amp;format_ctx, source.toLocal8Bit(), nullptr, nullptr);
    vsi = av_find_best_stream(format_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, nullptr, 0);
    codec_par = avcodec_parameters_alloc();
    avcodec_parameters_copy(codec_par, format_ctx->streams[vsi]->codecpar);

    AVCodec* codec = avcodec_find_decoder(codec_par->codec_id); // AV_CODEC_ID_PNG(61)
    codec_ctx = avcodec_alloc_context3(codec);
    avcodec_parameters_to_context(codec_ctx, codec_par);
    avcodec_parameters_free(&amp;codec_par);
    avcodec_open2(codec_ctx, codec, 0);