Recherche avancée

Médias (91)

Autres articles (43)

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

Sur d’autres sites (6793)

  • How does one correctly avoid the avcodec_alloc_context3 leak from avformat_new_stream ?

    14 avril 2017, par Tom Seddon

    This maddening thread describes the problem I’m having : a memory leak on shutdown due to some stuff allocated when avformat_new_stream is called.

    Here’s the valgrind stack trace from the leak :

    • 1,447 (1,440 direct, 7 indirect) bytes in 1 blocks are definitely lost in loss record 2 of 4
    • at 0x4C2FFC6 : memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    • by 0x4C300D1 : posix_memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    • by 0x690DEFF : av_malloc (mem.c:87)
    • by 0x690E09D : av_mallocz (mem.c:224)
    • by 0x533D28A : init_context_defaults (options.c:128)
    • by 0x533D325 : avcodec_alloc_context3 (options.c:164)
    • by 0x663D09E : avformat_new_stream (utils.c:4384)
    • by 0x4204B6 : main (test_ffmpeg.cpp:918)

    So clearly the problem is that when a AVFormatContext’s stream’s codec context’s priv_data field is somehow not being freed.

    My code frees the AVFormatContext with avformat_free_context. This calls ff_free_stream, which calls free_stream, which frees a few of the stream’s codec context fields itself - but not the priv_data field !

    Compared and contrast with the corresponding code in avcodec_close.

    The suggested solution to the problem from the thread : "close the codec firstly before calling av_format_free_context". Presumably this refers to calling avcodec_free_context ? - but I’m already doing this ! Roughly following the structure in the muxing example, I have an encoder context created by my code, that’s used to track the uncompressed input data. Then there’s another encoder context created internally by avformat_new_stream (as above), which is used internally by FFmpeg. I close the former, because it was opened using avcodec_open2, but I don’t close the latter, because it wasn’t. I am following the maddening thread’s advice, and yet here I am.

    Furthermore, reading between the lines, using avcodec_free_context to free the AVStream’s codec context is no good anyway, because when doing this (a) AVStream’s codec field is deprecated, so this gives a bunch of warnings, and (b) there are no NULL checks in free_stream, so this crashes at runtime.

    What I have done for now is drag in the appropriate bit of code from avcodec_close, and put it in my own code just ahead of the call to avformat_free_context :

    #ifdef __GNUC__
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
    #endif
       for(unsigned i=0;inb_streams;++i) {
           AVStream *st=avf_context->streams[i];

           if(st->codec->priv_data&&
              st->codec->codec&&
              st->codec->codec->priv_class)
           {
               av_opt_free(st->codec->priv_data);
           }

           av_freep(&st->codec->priv_data);
       }
    #ifdef __GNUC__
    #pragma GCC diagnostic pop
    #endif

    So that fixes the leak, and it’s clearly (to my eyes) a bug, and I need to file a bug report or something.

    However the corresponding bug report is marked as fixed and closed... along with a link back to the maddening thread, and no further explanation. (This is why it is maddening !) So maybe I’m just using FFmpeg wrongly ?

    Can anybody confirm whether this is actually a bug in FFmpeg or not ?

    If it isn’t a bug, what’s the right sequence of calls to make ?

    (I’m using FFmpeg built locally from commit 03eb0515c12637dbd20c2e3ca8503d7b47cf583a. I had similar-looking problems with the one you get from the Ubuntu 16 package manager, which prompted me to build it myself with symbols and so on.)

  • Add Windows resource file support for shared libraries

    5 décembre 2013, par James Almer
    Add Windows resource file support for shared libraries
    

    Originally written by James Almer <jamrial@gmail.com>

    With the following contributions by Timothy Gu <timothygu99@gmail.com>

    * Use descriptions of libraries from the pkg-config file generation function
    * Use "FFmpeg Project" as CompanyName (suggested by Alexander Strasser)
    * Use "FFmpeg" for ProductName as MSDN says "name of the product with which the
    file is distributed" [1].
    * Use FFmpeg’s version (N-xxxxx-gxxxxxxx) for ProductVersion per MSDN [1].
    * Only build the .rc files when —enable-small is not enabled.

    [1] http://msdn.microsoft.com/en-us/library/windows/desktop/aa381058.aspx

    Signed-off-by : James Almer <jamrial@gmail.com>
    Signed-off-by : Michael Niedermayer <michaelni@gmx.at>

    • [DH] Changelog
    • [DH] Makefile
    • [DH] common.mak
    • [DH] configure
    • [DH] libavcodec/Makefile
    • [DH] libavcodec/avcodecres.rc
    • [DH] libavdevice/Makefile
    • [DH] libavdevice/avdeviceres.rc
    • [DH] libavfilter/Makefile
    • [DH] libavfilter/avfilterres.rc
    • [DH] libavformat/Makefile
    • [DH] libavformat/avformatres.rc
    • [DH] libavresample/Makefile
    • [DH] libavresample/avresampleres.rc
    • [DH] libavutil/Makefile
    • [DH] libavutil/avutilres.rc
    • [DH] libpostproc/Makefile
    • [DH] libpostproc/postprocres.rc
    • [DH] library.mak
    • [DH] libswresample/Makefile
    • [DH] libswresample/swresampleres.rc
    • [DH] libswscale/Makefile
    • [DH] libswscale/swscaleres.rc
  • make ffmpeg chose Nvidia CUDA over Intel QSV (Windows 10 with two video adapters)

    3 avril 2024, par Bart Lederman

    I just set up a 'new' PC with built-in Intel video and an Nvida card : mostly to speed up video processing with ffmpeg and other programs. At first the built-in Intel was disabled, running only the Nvidia card. ffmpeg worked as expected, the CPU could be used for decoding and encoding.

    &#xA;

    However : VirtualDub, a program I use frequently, has a problem with Nvidia cards (at least on Windows 10). The display gets screwed up, previews don't work, and all sorts of other problems occur. I tried all of the various discussion boards, and nobody has a good solution. (The problem is apparently split between VirtualDub and Nvidia, as all other programs such as VideoLan, Avidemux, HandBrake, OBS studio, etc, all appear to work fine.)

    &#xA;

    So I re-enabled the on-board Intel adapter, and made that my primary and only video with a monitor. The Nvidia card is still there, but with no monitor attached. I really only need it for hardware acceleration.

    &#xA;

    HandBrake and OBS Studio found the card and used it with no problem.

    &#xA;

    However, my batch file that specified cuda for both decoding and encoding failed to run. The ffmpeg command that includes -hwaccel cuda resulted in :

    &#xA;

    [h264 @ 000002783beaa700] Hardware is lacking required capabilities &#xA;[h264 @ 000002783beaa700] Failed setup for format cuda: hwaccel initialisation returned error.&#xA;

    &#xA;

    I also tried -hwaccel nvenc, which is rejected. It's apparently not a synonym in this version of ffmpeg :

    &#xA;

    ffmpeg version 4.3.1-2021-01-01-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers built with gcc 10.2.0 (Rev5, Built by MSYS2 project) configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100&#xA;

    &#xA;

    When I use QSV acceleration on my other PC I have to do this :

    &#xA;

    -init_hw_device qsv=qsv -hwaccel qsv&#xA;

    &#xA;

    so I tried

    &#xA;

    -init_hw_device cuda=cuda -hwaccel cuda&#xA;

    &#xA;

    but that didn't work either.

    &#xA;

    I've seen comments about the ability to select the GPU if there is more than one board installed, using the -gpu option. However, when I try to use -gpu 0 or -gpu 1 I get :

    &#xA;

    Codec AVOption gpu (Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on.) specified for input file #0 (xxx.avi) is not a decoding option.

    &#xA;

    I looked at :

    &#xA;

    https://github.com/FFmpeg/FFmpeg/commit/527a1e213167123d24d014bc0b956ef43d9d6542

    &#xA;

    to get more information on -init_hw_device, but I'm sorry to say that what's on that page makes no sense to me at all. There are no examples, and no explanation of how to actually select a device.

    &#xA;

    I looked at :

    &#xA;

    https://docs.nvidia.com/video-technologies/video-codec-sdk/ffmpeg-with-nvidia-gpu/

    &#xA;

    which has an 'example' of -init_hw_device, and I did a cut and paste of what they had there to my batch file, but it was rejected.

    &#xA;

    I also looked at :

    &#xA;

    How to to burn subtitles based image on video using ’overlay_cuda’, ffmpeg video filter

    &#xA;

    which has two examples of how to initialize a cuda device, and they don't work for me either. -init_hw_device cuda=cuda is accepted without error, but then -hwaccel cuda still fails. Trying to use the hw accelerated filter scale_cuda also fails.

    &#xA;

    So how do I get the Nvidia card to decode video when it's not the only graphics adapter ? I was able to decode video when only the Nvidia card was active, there "must" be a way to get to it now. I just need to know how to tell ffmpeg to use the card that is there. Since it has no problem finding the card for encoding, shouldn't it also still be able to find the card for decoding and filters ? Or am I really the first person ever to have both Intel and Nvidia graphics adapters working on my system and trying to use ffmpeg with hardware acceleration ?

    &#xA;

    =====================

    &#xA;

    Latest update.

    &#xA;

    I had tried the examples on the Nvidia FFmpeg transcoding guide web page, and as mentioned previously I still got errors. I did a cut and paste from that web page to my command window, and ffmpeg still did not find the correct graphics adapter.

    &#xA;

    However, I do have a work-around. I don't particularly like it, but it works.

    &#xA;

    First : Windows (10) does not understand the concept of a graphics adapter that doesn't have a monitor attached to it. Even though graphics processors (specifically Nvidia) are available without the actual video output and are used in supercomputers and elsewhere to do high speed stream processing, Windows will not let you access the card settings if there is no monitor attached. The Nvidia control center also will not allow you to access any of the card's settings, and you can't set processor affinity.

    &#xA;

    So I connected a second monitor, and set up the Nvidia card as the primary.

    &#xA;

    Now ffmpeg -hwaccel cuda works the first time. The command I was using before :

    &#xA;

    ffmpeg -hide_banner -hwaccel cuda -i "input.avi" -c:a copy -ac 1 -c:v h264_nvenc -preset hq -movflags faststart -qp 30 "output.mp4"&#xA;

    &#xA;

    Was failing because it couldn't find the Nvidia adapter. This command now works correctly the first time and uses hardware acceleration for both decode and encode. (The audio portion is irrelevant, if I also re-encode the audio the results are the same.)

    &#xA;

    With scaling, the command was like this :

    &#xA;

    ffmpeg -hide_banner -hwaccel cuda -i "input.avi" -c:a copy -ac 1 -c:v h264_nvenc -preset hq -vf "scale=640:480" -movflags faststart -qp 30 "output.mp4"&#xA;

    &#xA;

    This works. However :

    &#xA;

    ffmpeg -hide_banner -hwaccel cuda -i "input.avi" -c:a copy -ac 1 -c:v h264_nvenc -preset hq -vf "scale_cuda=640:480" -movflags faststart -qp 30 "output.mp4&#xA;

    &#xA;

    Fails with

    &#xA;

    Impossible to convert between the formats supported by the filter &#x27;graph 0 input from stream 0:0&#x27; and the filter &#x27;auto_scaler_0&#x27;&#xA;Error reinitializing filters!&#xA;Failed to inject frame into filter network: Function not implemented&#xA;Error while processing the decoded data for stream #0:0&#xA;

    &#xA;

    I was able to get around this, by rearranging things in what seems to be to be an unnecessarily convoluted syntax.

    &#xA;

    ffmpeg -hide_banner -hwaccel cuvid -hwaccel_output_format cuda -i "input.avi" -c:a aac -b:a 192k -ar 48000 -vf "scale_cuda=856:480" -c:v h264_nvenc -preset hq -movflags faststart -qp 26 "output.mp4"&#xA;

    &#xA;

    Having to specify the output format twice seems weird, but Task Manager shows near 100% Video Decode activity, and the time it takes to do this indicates to me that the scale_cuda filter is being used.

    &#xA;

    I don't particularly like having to use a second monitor (If VirtualDub worked properly I probably wouldn't have to), but I'm willing to live with it. It appears that if you have two different video cards and you want to use hardware acceleration on one of them it has to be the primary.

    &#xA;

    I haven't tested if Intel QSV is still accessible, nor have I tried switching the order of the graphics adapters back to completely verify the source of the problem, and I'm not really planning to do so (unless some of you think that would be useful). I get the definite impression that few people, if any, have tried to get both an Nvidia and an Intel adapter to provide hardware video acceleration on the same system. I will try to access QSV to see if using both accelerators is an improvement.

    &#xA;

    I can live with the weird command line to get the cuda filters to work, but if anyone knows a better way to do it I think it would be helpful to post it here for future reference if anyone else runs into a similar problem. None of the examples of using cuda accelerated filters that I've found on any of the many web sites I've read worked exactly as given.

    &#xA;

    ==================

    &#xA;

    The good news :

    &#xA;

    It's possible to use both Nvidia and QSV hardware in at least some cases.

    &#xA;

    This command works :

    &#xA;

    ffmpeg -hide_banner -hwaccel dxva2 -i "input.avi" -c:a copy ^&#xA;  -c:v h264_qsv -vf "crop=1920:1044:0:0" -preset veryfast -profile:v high -level 4.1 -qp 22 "output.mp4"&#xA;

    &#xA;

    Task Manager says Nvidia is decoding the input, and GPU-Z says Intel is also active, so it must be doing the encoding.

    &#xA;

    The bad news : I can't figure out a way to use both a CUDA filter and a standard filter in the same process.

    &#xA;

    This does not work :

    &#xA;

    ffmpeg -hide_banner -hwaccel cuvid -hwaccel_output_format cuda -i "input.avi" -c:a aac -b:a 192k -ar 48000 -vf "scale_cuda=856:480,crop=1280:696:0:24" -c:v h264_nvenc -preset hq -movflags faststart -qp 30 "output.mp4"&#xA;

    &#xA;

    Reversing the order of scale_cuda and crop (with appropriate adjustments to the numbers) also does not work. There are errors about not being able to transfer the processing stream.

    &#xA;

    I will try the changes in the latest comment, but I think I may have tried it before and something didn't work. But I will check again.

    &#xA;

    In my web searches I have not found an example of 'mixed' filters.

    &#xA;

    I did see "-crop" and "-resize" on the Nvidia ffmpeg trancode web page similar to this :

    &#xA;

    –crop 0x36x0x0 –resize 1280x696&#xA;

    &#xA;

    Once again, I did a cut and paste from the Nvidia web page to my command window and it didn't work. If there is a way to invoke the Nvidia command for these options that has been tested and found to actually work I would really like to see it.

    &#xA;