Recherche avancée

Médias (3)

Mot : - Tags -/pdf

Autres articles (96)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

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

  • Problèmes fréquents

    10 mars 2010, par

    PHP et safe_mode activé
    Une des principales sources de problèmes relève de la configuration de PHP et notamment de l’activation du safe_mode
    La solution consiterait à soit désactiver le safe_mode soit placer le script dans un répertoire accessible par apache pour le site

Sur d’autres sites (5024)

  • Can´t convert .mp4 file to .mjpeg file with ffmpeg

    19 février 2018, par Herr HupfDohle

    I use ffmpeg to convert a .mp4 file to a .mjpeg file and I fail doing so.
    What i tried so far :
    Converting directly from .mp4 to .mjpeg with one of these :

       "ffmpeg -i input.mp4 output.mjpeg"
       "ffmpeg -i input.mp4 -framerate 25 output.mjpeg"

    Getting all the individual images of my video (which worked fine) and put them together to a .mjpeg file did not work as well.

       "ffmpeg -i input.mp4 image%d.jpeg"
       "ffmpeg -f image2 -i image%d.jpeg output.mjpeg", or
       "ffmpeg -f image2 -i image%d.jpeg -framerate 25 output.mjpeg"

    "Solutions" like the following one did not work, cause I need a file extension .mjpeg so -c:v mjpeg is not enough cause I end up with sth. like .mov !

    "ffmpeg -i input.mov -c:v mjpeg -q:v 3 -huffman optimal -an output.mov"

    To view my files I use vlc player.

    I always end up with a .mjpeg file which has the length of 10 seconds and only shows the very first image of my 4000 pictures.

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

  • Hardware accelerated decoding with FFmpeg falls back to software decoding

    9 février 2024, par iexav

    So I have followed the FFmpeg example for hardware accelerated decoding exactly as it is (I am referring to this example).

    &#xA;

    https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/hw_decode.c#L76&#xA;

    &#xA;

    But I still seem to be decoding with the software decoder. When I open the task manager on windows the GPU isn't getting used. Before I make a call to av_hwframe_transfer_data() I check whether the frame is in the relevant hw_pix_fmt format and it is. Everything works, no errors, nothing, except the GPU is doing nothing. Now as an example I tried decoding a video that uses vp9 as a codec. If I specify the hardware accelerated codec I want by name it actually does work.

    &#xA;

    vidCodec=avcodec_find_decoder_by_name("vp9_cuvid"); &#xA;

    &#xA;

    When I do this and look at the task manager I can see that the CPU does much less work and my GPU actually does Video Decode work. Having to specify the hardware accelerated decoder for every single video I am decoding is ridiculous though.

    &#xA;

    Edit : as per user4581301's answer, here are the pieces of relevant code. (It's actually in java because I am using the java FFmpeg wrapper but it's basically just making a bunch of calls to FFmpeg functions.)

    &#xA;

    &#xA; ArrayList<string> deviceTypes = new ArrayList&lt;>();&#xA; int type = AV_HWDEVICE_TYPE_NONE;&#xA;                    while ((type = av_hwdevice_iterate_types(type)) != AV_HWDEVICE_TYPE_NONE) {&#xA;                        BytePointer p = av_hwdevice_get_type_name(type);&#xA;&#xA;                        deviceTypes.add(CString(p));&#xA;                    }&#xA;                    boolean flag=false;&#xA;&#xA;                    for(int j=0;j* Allocate a codec context for the decoder */&#xA;                if ((video_c = avcodec_alloc_context3(vidCodec)) == null) {&#xA;                    throw new Exception("avcodec_alloc_context3() error: Could not allocate video decoding context.");&#xA;                }&#xA;&#xA;&#xA;                /* copy the stream parameters from the muxer */&#xA;&#xA;                if ((ret = avcodec_parameters_to_context(video_c, video_st.codecpar())) &lt; 0) {&#xA;                    releaseUnsafe();&#xA;                    throw new Exception("avcodec_parameters_to_context() error " &#x2B; ret &#x2B; ": Could not copy the video stream parameters.");&#xA;                }&#xA;              &#xA;&#xA;                    video_c.get_format(AvFormatGetter.getInstance());&#xA;                    AVBufferRef hardwareDeviceContext =av_hwdevice_ctx_alloc(type);&#xA;&#xA;                    if ((ret = av_hwdevice_ctx_create(hardwareDeviceContext, type,(String) null, null, 0)) &lt; 0) {&#xA;                        System.err.println("Failed to create specified HW device. error " &#x2B; ret);&#xA;&#xA;                    }else{&#xA;                        video_c.hw_device_ctx(av_buffer_ref(hardwareDeviceContext));&#xA;&#xA;                    }&#xA;    &#xA;&#xA;&#xA;                &#xA;//The function that gets called for get_format&#xA;@Override&#xA; public int call(AVCodecContext context, IntPointer format) {&#xA;            int p;&#xA;&#xA;&#xA;            for (int i=0;;i&#x2B;&#x2B;) {&#xA;                if ((p=format.get(i)) == hw_pix_fmt) {&#xA;                    return p;&#xA;                }&#xA;                if(p==-1){&#xA;                    break;&#xA;                }&#xA;            }&#xA;&#xA;            System.out.println(hw_pix_fmt &#x2B;" is not found in the codec context");&#xA;            // Error&#xA;&#xA;            return AV_PIX_FMT_NONE;&#xA;        }&#xA;    &#xA;//The method that&#x27;s used for decoding video frames&#xA;  public Optional<boolean> decodeVideoFrame(AVPacket pkt, boolean readPacket, boolean keyFrames) throws Exception {&#xA;&#xA;        int ret;&#xA;        // Decode video frame&#xA;        if (readPacket) {&#xA;            ret = avcodec_send_packet(video_c, pkt);&#xA;          &#xA;            if (ret &lt; 0) {&#xA;                System.out.println("error during decoding");&#xA;                return Optional.empty();&#xA;            }&#xA;&#xA;            if (pkt.data() == null &amp;&amp; pkt.size() == 0) {&#xA;                pkt.stream_index(-1);&#xA;            }&#xA;           &#xA;        }&#xA;&#xA;        // Did we get a video frame?&#xA;        while (true) {&#xA;            ret = avcodec_receive_frame(video_c, picture_hw);&#xA;&#xA;            if (ret == AVERROR_EAGAIN() || ret == AVERROR_EOF()) {&#xA;                if (pkt.data() == null &amp;&amp; pkt.size() == 0) {&#xA;                    return Optional.empty();&#xA;                } else {&#xA;&#xA;                    return Optional.of(true);&#xA;&#xA;                }&#xA;            } else if (ret &lt; 0) {&#xA;&#xA;                // Ignore errors to emulate the behavior of the old API&#xA;                // throw new Exception("avcodec_receive_frame() error " &#x2B; ret &#x2B; ": Error during video decoding.");&#xA;                return Optional.of(true);&#xA;&#xA;            }&#xA;&#xA;            if (!keyFrames || picture.pict_type() == AV_PICTURE_TYPE_I) {&#xA;              &#xA;                if(picture_hw.format()==hw_pix_fmt){&#xA;                    if (av_hwframe_transfer_data(&#xA;                            picture, // The frame that will contain the usable data.&#xA;                            picture_hw, // Frame returned by avcodec_receive_frame()&#xA;                            0) &lt; 0) {&#xA;                        throw new Exception("Could not transfer data from gpu to cpu. ");&#xA;&#xA;                    }&#xA;                }&#xA;               //... The rest of the method here&#xA;                return Optional.of(false);&#xA;&#xA;            }&#xA;        }&#xA;    }&#xA;</boolean></string>

    &#xA;