Recherche avancée

Médias (91)

Autres articles (56)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (6044)

  • 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);