Recherche avancée

Médias (17)

Mot : - Tags -/wired

Autres articles (63)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

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

  • Contribute to a better visual interface

    13 avril 2011

    MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
    Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.

Sur d’autres sites (4855)

  • C++ Invalid read of size 16, Address is 744 bytes inside a block of size 752 alloc'd

    17 août 2022, par Turgut

    I know there are similar questions to this one but I can't seem to find the solution in my own circumstances.

    


    I've made a program using opengl and ffmpeg that uses a buffer to complete it's operations. Normally, the program runs just fine with no errors whatsoever. However when I run my application using valgrind I get this error :

    


    ==31277== Invalid read of size 16
==31277==    at 0xD27852: memcpy (string_fortified.h:29)
==31277==    by 0xD27852: scale_internal (swscale.c:947)
==31277==    by 0xD29EE8: sws_scale (swscale.c:1213)
==31277==    by 0x268BBC: Videooio::video_encoder::set_frame_yuv_from_rgb(AVFrame*, SwsContext*) (video_encoder.cpp:441)
==31277==    by 0x268D18: Videooio::video_encoder::get_video_frame(Videooio::OutputStream*) (video_encoder.cpp:486)
==31277==    by 0x269032: write_video_frame (video_encoder.cpp:499)
==31277==    by 0x269032: Videooio::video_encoder::encode_one_frame() (video_encoder.cpp:553)
==31277==    by 0x22BD89: Videooio::Application::main_loop() (Application.cpp:212)
==31277==    by 0x21B007: Videooio::Application::Run() (Application.cpp:70)
==31277==    by 0x219C94: main (main.cpp:22)
==31277==  Address 0x50df9c8 is 744 bytes inside a block of size 752 alloc'd
==31277==    at 0x4849013: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==31277==    by 0x21A970: Videooio::Application::Run() (Application.cpp:40)
==31277==    by 0x219C94: main (main.cpp:22)


    


    I've diagnosed the problem down to the following lines but I'm not quite sure how to fix it :

    


    Application.cpp

    


    void Run()
{
  ...
40   encoder = new video_encoder(width, height, fps, duration);
  ...
      while (second < duration)
     {
      auto* fbo = opengl_engine.glBuffer;

      encoder->set_encode_framebuffer(fbo);
212   encoder->encode_one_Frame();
     }
}


    


    video_encoder.h :

    


    namespace Videooio{
class video_encoder{
    public:
        video_encoder(int w, int h, unsigned int fps, unsigned int duration);
        
        void set_encode_framebuffer(uint8_t* data, bool audio_only = false);

        void encode_one_frame();
        ~video_encoder();  
    private:
        int write_frame(AVFormatContext *fmt_ctx, AVCodecContext *c,
                       AVStream *st, AVFrame *frame, AVPacket *pkt);

        AVFrame *get_video_frame(OutputStream *ost);

        int write_video_frame(AVFormatContext *oc, OutputStream *ost);

        uint8_t *rgb_data;

        int width;
        int height;
        
        void set_frame_yuv_from_rgb(AVFrame *frame, struct SwsContext *sws_context);
       
    };
}  


    


    Here is opengl_engine, where fbo is allocated :

    


    ...
if (posix_memalign((void**)&glBuffer, 128, (gl_width * gl_height * 4) ) != 0) 
{
   ERROR("Couldn't allocate frame buffer ");
   return false;
}
...


    


    Here is where I set the rgb_data that is inside the encoder (Probably the culprit too) is set to the allocated fbo :

    


    void video_encoder::set_audio_frame(AVFrame* audio, AVSampleFormat* format)
{
    audio_data = *audio;
    input_sample_fmt = *format;
}


    


    rgb_data is set uninitialized up until this point before it's usage (I've tried mallocing it inside the constructor, which was a horrible practice, but doing so changed nothing.).
And here is where it's used and where valgrind mentions :

    


       void video_encoder::set_frame_yuv_from_rgb(AVFrame *frame, struct SwsContext 
   *sws_context) {
       const int in_linesize[1] = { 4 * width };
       //uint8_t* dest[4] = { rgb_data, NULL, NULL, NULL };
       sws_context = sws_getContext(
               width, height, AV_PIX_FMT_RGBA,
               width, height, AV_PIX_FMT_YUV420P,
               SWS_BICUBIC, 0, 0, 0);
440    std::cout << "Address: " << rgb_data << std::endl;
441    sws_scale(sws_context, (const uint8_t * const *)&rgb_data, in_linesize, 0,
442            height, frame->data, frame->linesize);
}


    


    I'm not %100 sure whether rgb_data is causing this error or not but digging into sws_scale and finding where memcpy is used shows that rgb_data is used inside it.

    


    I've tried changing the buffer size of glBuffer to no avail since valgrind allways says 744 bytes inside a block of size 752 the size of which the error mentions is not changing when I change glBuffers size, this led me to believe that rgb_data might not be the culprit. But it's still my best bet.

    


    I've looked into these questions but I just can't seem to apply them to my own circumstance.

    


    Question 1
Question 2

    


    I'm using ubuntu.

    


  • I want to record my computer screen and stream it to other computer browser over same network

    25 décembre 2022, par Abdullah Qasim

    I am using Flask for this purpose. I wanted to create a rtmp server that stream the screen in web browser.

    


    My Python Code is :

    


    import os
import subprocess

from flask import Flask, render_template

app = Flask(__name__)

@app.route('/')
def index():
    return render_template('index.html')

if __name__ == '__main__':
    # Start the RTMP server in a separate process
    subprocess.Popen(['ffmpeg', '-f', 'gdigrab', '-framerate', '25', '-probesize', '100000000000', '-i', 'desktop', '-vcodec', 'libx264', '-preset', 'ultrafast', '-tune', 'zerolatency', '-f', 'flv', 'rtmp://localhost:5000/live/stream_name'])

    # Start the Flask app
    app.run()



    


    My HTML code is :

    


    &#xA;  &#xA;    &#xA;    &#xA;    <code class="echappe-js">&lt;script src=&quot;https://unpkg.com/video.js/dist/video.js&quot;&gt;&lt;/script&gt;&#xA;  &#xA;  &#xA;    &#xA;    &lt;script&gt;&amp;#xA;      var player = videojs(&amp;#x27;my-video&amp;#x27;);&amp;#xA;    &lt;/script&gt;&#xA;  &#xA;&#xA;&#xA;

    &#xA;

    When I run the flask app it produces an error :

    &#xA;

    * Serving Flask app &#x27;server&#x27; (lazy loading)&#xA; * Environment: production&#xA;   WARNING: This is a development server. Do not use it in a production deployment.&#xA;   Use a production WSGI server instead.&#xA; * Debug mode: off&#xA;ffmpeg version N-109449-gb92260f70a-20221223 Copyright (c) 2000-2022 the FFmpeg developers&#xA;  built with gcc 12.2.0 (crosstool-NG 1.25.0.90_cf9beb1)&#xA;  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-libmfx --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20221223&#xA;  libavutil      57. 43.100 / 57. 43.100&#xA;  libavcodec     59. 55.103 / 59. 55.103&#xA;  libavformat    59. 34.102 / 59. 34.102&#xA;  libavdevice    59.  8.101 / 59.  8.101&#xA;  libavfilter     8. 53.100 /  8. 53.100&#xA;  libswscale      6.  8.112 /  6.  8.112&#xA;  libswresample   4.  9.100 /  4.  9.100&#xA;  libpostproc    56.  7.100 / 56.  7.100&#xA; * Running on http://127.0.0.1:5000/ (Press CTRL&#x2B;C to quit)&#xA;[gdigrab @ 00000134692d9cc0] Capturing whole desktop as 1280x1024x32 at (0,0)&#xA;Input #0, gdigrab, from &#x27;desktop&#x27;:&#xA;  Duration: N/A, start: 1671986678.012939, bitrate: 1048586 kb/s&#xA;  Stream #0:0: Video: bmp, bgra, 1280x1024, 1048586 kb/s, 25 fps, 25.08 tbr, 1000k tbn&#xA;127.0.0.1 - - [25/Dec/2022 21:44:39] code 400, message Bad request version (&#x27;&#xFB;\x9be&#xF9;S&#xD8;H&#xE3;Eie&#xD0;&#xD7;kbz\x84&#xE3;^\x9d&#xDA;&#xBD;\x8bC&#xF0;&#xFA;&#xDA;&#xEE;E\x8c&#xDF;Y&#xEB;&#xD7;s\x92.&#x27;)&#xA;127.0.0.1 - - [25/Dec/2022 21:44:39] "♥ |☻&#xF7;xU▲&#xCE;&#xAB;▲6/&#xC5;p&#xB2;f&#xD4;☻ a↑&#xA2;.6&#xD5;&#xFC;&#x2B;c)&#xC2;.&#xE7;&#xC7;&#xC9;&#xB0;&#xB5;&#xB3;E&#xDF;&#xA8;9&#xEA;;&#xC8;y ►hBZ&#xA1;↨L&#xB5;rX&#xCF;&#xEB;&#xE2;M&#xA4;.&#xC4;&#xFF;{@o↑&#xC9;[&#xFD;&#xD0;N&#xE4;o2&#xB6;&#xA4;{&#xF6;&#xB0;RT&#xE2;Z&#xE9;&#xA9;&#xA8;&#xB4;&#xC5;Ion&#xD7;&#xC6;&#xB6;&#xBC;&#xC8;Ai&#xE6;>7/&#xFE;↑m&#xA8;Q8b&#xC5;&#xAF;&#xDE;&#xB5;&#xA1;!w&#xE2;&#xD9;&#xE2;&#xC4;t&#xB1;&#xF5;&#xA7;&#xF0;&#xB2; &#xAE;&#xA;      &#xB7;&#xD7;&#xAB;2&#xF9;&#xF0;T&#xAB;{                   &#xFD;?&#xF2;&#xB8;&#xF6;$&#xAC;p&#xF2;p&#xF3;w4&#xEA;&#xF1;Of&#xAC;=d&#xE2;2♣D&#xA4;B                            &#xA4;↓▲&#xF4;m&lt;&#xB7;-/"C&#xD1;u*A&amp;2&#xD6;j u&#xF5;&#xD3;☻&#xF4;\&#xDF;&#x2B;&#xC5;&#xA7;&#xAB;&#xF8;↑1☺&#xCE;&#xA6;&#xFA;&#xEC;\y&#xAA;~&#xC7;↑▲&#xA4;Y&#xED;n&#xA;e&#xEE;&#xD4;ioP&#xFE;♣&#xFC; M&#xC3;&#xAD;▲^&#xF4;&#xFC;d&#xD5;{∟&#xB6;&#xB6;jE▼j♦1V&#xD2;YW&#xD7;▼&#xA9;&#xC0;&#xF1;_K|&#xF7;&#xB6;&#xC3;}&#xA6;  ↑a↔;☻&#xFF;|&#xC9;@8u7&#xD3;8.Ak&#xD5;uwM&#xF9;&#xCA;&#xF7;H5!P&#xCE;&#xD0;&#xDB;&#xB4;▼&#xC3;d&#xE1;~5i&#xE3;&#xA;▬e&#xA;&#xFB;&#xF9;S&#xD8;H&#xE3;Eie&#xD0;&#xD7;kbz&#xA;              &#xE3;^C&#xF0;&#xFA;&#xDA;&#xEE;E&#xDF;Y&#xEB;&#xD7;s." 400 -&#xA;[rtmp @ 000001346ae35180] Cannot read RTMP handshake response&#xA;rtmp://localhost:5000/live/stream_name: End of file&#xA;

    &#xA;

    I have searched on internet to fix this error but did not got any help.

    &#xA;

  • nvenc : De-compensate aspect ratio compensation of DVD-like content.

    28 janvier 2015, par Philip Langdale
    nvenc : De-compensate aspect ratio compensation of DVD-like content.
    

    For reasons we are not privy to, nvidia decided that the nvenc encoder
    should apply aspect ratio compensation to ’DVD like’ content, assuming that
    the content is not BT.601 compliant, but needs to be BT.601 compliant. In
    this context, that means that they make the following, questionable,
    assumptions :

    1) If the input dimensions are 720x480 or 720x576, assume the content has
    an active area of 704x480 or 704x576.

    2) Assume that whatever the input sample aspect ratio is, it does not account
    for the difference between ’physical’ and ’active’ dimensions.

    From these assumptions, they then conclude that they can ’help’, by adjusting
    the sample aspect ratio by a factor of 45/44. And indeed, if you wanted to
    display only the 704 wide active area with the same aspect ratio as the full
    720 wide image - this would be the correct adjustment factor, but what if you
    don’t ? And more importantly, what if you’re used to lavc not making this kind
    of adjustment at encode time - because none of the other encoders do this !

    And, what if you had already accounted for BT.601 and your input had the
    correct attributes ? Well, it’s going to apply the compensation anyway !
    So, if you take some content, and feed it through nvenc repeatedly, it
    will keep scaling the aspect ratio every time, stretching your video out
    more and more and more.

    So, clearly, regardless of whether you want to apply bt.601 aspect ratio
    adjustments or not, this is not the way to do it. With any other lavc
    encoder, you would do it as part of defining your input parameters or do
    the adjustment at playback time, and there’s no reason by nvenc should
    be any different.

    This change adds some logic to undo the compensation that nvenc would
    otherwise do.

    nvidia engineers have told us that they will work to make this
    compensation mechanism optional in a future release of the nvenc
    SDK. At that point, we can adapt accordingly.

    Signed-off-by : Philip Langdale <philipl@overt.org>
    Reviewed-by : Timo Rothenpieler <timo@rothenpieler.org>
    Signed-off-by : Anton Khirnov <anton@khirnov.net>

    • [DBH] libavcodec/nvenc.c