Recherche avancée

Médias (1)

Mot : - Tags -/lev manovitch

Autres articles (43)

  • Les vidéos

    21 avril 2011, par

    Comme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
    Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
    Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...)

  • 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

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

Sur d’autres sites (6039)

  • ffmpeg rtsp stream to YouTube livestream not doing anything

    29 mai 2018, par felixosth

    I’m using C# to initiate ffmpeg. I’ve a onvif bridge server for a CCTV VMS and I’m building a application to enable the user to livestream any CCTV camera to YouTube.

    The rtsp stream to the camera looks like this :

    rtsp ://onvif:bridge@localhost:554/live/xxxxx-xxxguidtocameraxxx-xxxxx

    I’m new to ffmpeg and I’m using this arg :

    -f lavfi -i anullsrc -rtsp_transport udp -i camerastreamurl -tune zerolatency -vcodec libx264 -pix_fmt + -c:v copy -c:a aac -strict experimental -f flv rtmp ://x.rtmp.youtube.com/live2/streamkey -loglevel debug

    It seems like ffmpeg isn’t finding the camera stream, only the fake audio one. It just freezes.

    This is the result of the debug log :

    ffmpeg version N-91172-gebf85d3190 Copyright (c) 2000-2018 the FFmpeg developers
     built with gcc 7.3.0 (GCC)
     configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
     libavutil      56. 18.102 / 56. 18.102
     libavcodec     58. 19.104 / 58. 19.104
     libavformat    58. 17.100 / 58. 17.100
     libavdevice    58.  4.100 / 58.  4.100
     libavfilter     7. 24.100 /  7. 24.100
     libswscale      5.  2.100 /  5.  2.100
     libswresample   3.  2.100 /  3.  2.100
     libpostproc    55.  2.100 / 55.  2.100
    Splitting the commandline.
    Reading option '-f' ... matched as option 'f' (force format) with argument 'lavfi'.
    Reading option '-i' ... matched as input url with argument 'anullsrc'.
    Reading option '-rtsp_transport' ... matched as AVOption 'rtsp_transport' with argument 'udp'.
    Reading option '-i' ... matched as input url with argument 'rtsp://onvif:bridge@localhost:554/live/41cf4f34-e137-4559-8278-47d912c64c5b'.
    Reading option '-tune' ... matched as AVOption 'tune' with argument 'zerolatency'.
    Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'libx264'.
    Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument '+'.
    Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'.
    Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'aac'.
    Reading option '-strict' ...Routing option strict to both codec and muxer layer
    matched as AVOption 'strict' with argument 'experimental'.
    Reading option '-f' ... matched as option 'f' (force format) with argument 'flv'.
    Reading option 'rtmp://x.rtmp.youtube.com/live2/xxxxxxxx' ... matched as output url.
    Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
    Finished splitting the commandline.
    Parsing a group of options: global .
    Applying option loglevel (set logging level) with argument debug.
    Successfully parsed a group of options.
    Parsing a group of options: input url anullsrc.
    Applying option f (force format) with argument lavfi.
    Successfully parsed a group of options.
    Opening an input file: anullsrc.
    detected 8 logical cores
    [AVFilterGraph @ 0000027a34bad7c0] query_formats: 2 queried, 3 merged, 0 already done, 0 delayed
    [Parsed_anullsrc_0 @ 0000027a34badb80] sample_rate:44100 channel_layout:'stereo' nb_samples:1024
    [lavfi @ 0000027a34babc80] All info found
    Input #0, lavfi, from 'anullsrc':
     Duration: N/A, start: 0.000000, bitrate: 705 kb/s
       Stream #0:0, 1, 1/44100: Audio: pcm_u8, 44100 Hz, stereo, u8, 705 kb/s
    Successfully opened the file.
    Parsing a group of options: input url rtsp://onvif:bridge@localhost:554/live/41cf4f34-e137-4559-8278-47d912c64c5b.
    Successfully parsed a group of options.
    Opening an input file: rtsp://onvif:bridge@localhost:554/live/41cf4f34-e137-4559-8278-47d912c64c5b.
    [tcp @ 0000027a34bb5980] No default whitelist set

    Edit :
    I’m getting this result with minimal args :
    ffmpeg result

  • ffmpeg problems with streaming mp4 over udp in local network

    28 novembre 2019, par AJ Cole

    I’m streaming mp4 video files (some of them are avi converted to mp4 with ffmpeg earlier) over udp://232.255.23.23:1234 from linux (embedded) with ffmpeg v3.4.2 to multiple linux (antix) machines that play the stream with MPV, all of this happens in local network so I expected it to work flawlessly, but unfortunately it doesn’t.

    Here are the original commands I tried to use :

    ffmpeg

    ffmpeg -re -i PATH_TO_FILE.mp4 -c copy -f mpegts udp://232.255.23.23:1234

    mpv

    mpv --no-config --geometry=[geo settings] --no-border udp://232.255.23.23:1234

    This seemed to woork good, however a problem appeared that on the displaying end, the stream is actually much longer than the streamed content itself. The mp4 files in total have 5 minutes 36 seconds, and mpv plays the entire stream loop in >= 6 minutes. I think it’s happening because of dropped frames, that mpv waits to recover or something and therefore extends the length of the actual content. This cannot work in my case, as I have a precise time gap for displaying the stream and it cannot be longer than the streamed content.
    All the content is made in 1680x800 resolution and is displayed on a screen with 1680x1050 resoltion (positioned with mpv geometry)

    It appears that using this command for mpv :

    mpv --no-config --framedrop=no --geometry=[geo settings] --no-border udp://232.255.23.23:1234

    made the duration correct, however this introduces huge artifacts in the videos sometimes.

    I read that using -re for streaming can cause these frame drops, so I tried putting a static number of fps for both file input and output stream, for example :

    ffmpeg -re -i PATH_TO_FILE.mp4 -c copy -r 25 -f mpegts udp://232.255.23.23:1234

    This reads the file at native framerate and outputs the stream at 25fps, and it appears to have the timing duration correct, but it also causes occasional articats and I think has worse qualit overall. Output from mpv when one of the artifacts happened :

    [ffmpeg/video] h264: cabac decode of qscale diff failed at 85 19
    [ffmpeg/video] h264: error while decoding MB 85 19, bytestream 85515

    I also tried using --untimed or --no-cache in mpv, but this causes stutters in the video

    I’m also getting requent Invalid video timestamp warnings in MPV, for example : Invalid video timestamp: 1.208333 -> -8.711667

    Playing in mpv without --no-config and with --untimed added also causes frequent artifacts :

    V: -00:00:00 / 00:00:00 Cache:  0s+266KB
    [ffmpeg/video] h264: Invalid NAL unit 8, skipping.
    V: -00:00:00 / 00:00:00 Cache:  0s+274KB
    [ffmpeg/video] h264: Reference 4 >= 4
    [ffmpeg/video] h264: error while decoding MB 6 0, bytestream 31474
    [ffmpeg/video] h264: error while decoding MB 78 49, bytestream -12
    V: 00:00:06 / 00:00:00 Cache:  5s+11KB
    Invalid video timestamp: 6.288333 -> -8.724933
    V: -00:00:05 / 00:00:00 Cache:  3s+0KB
    [ffmpeg/video] h264: Invalid NAL unit 8, skipping.
    [ffmpeg/video] h264: error while decoding MB 59 24, bytestream -27
    V: -00:00:04 / 00:00:00 Cache:  3s+0KB
    [ffmpeg/video] h264: Reference 4 >= 3
    [ffmpeg/video] h264: error while decoding MB 5 2, bytestream 13402
    V: -00:00:03 / 00:00:00 Cache:  2s+0KB
    [ffmpeg/video] h264: Reference 5 >= 4
    [ffmpeg/video] h264: error while decoding MB 51 21, bytestream 9415

    I tried playing the stream with ffplay and it also caused the videos to be "played" 20 seconds longer.
    Is there any way to keep the streaming duration intact and prevent those huge artifacts ? These aren’t any huge video files, they are few MB each, everything happens in local network so the latencies are minimal.

    Output from ffmpeg when streaming one of the files :

    libavutil      55. 78.100 / 55. 78.100
     libavcodec     57.107.100 / 57.107.100
     libavformat    57. 83.100 / 57. 83.100
     libavdevice    57. 10.100 / 57. 10.100
     libavfilter     6.107.100 /  6.107.100
     libswscale      4.  8.100 /  4.  8.100
     libswresample   2.  9.100 /  2.  9.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'SDM.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.48.100
     Duration: 00:00:20.00, start: 0.000000, bitrate: 1883 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1680x800 [SAR 1:1 DAR 21:10], 1880 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
       Metadata:
         handler_name    : VideoHandler
    Output #0, mpegts, to 'udp://232.255.23.23:1234':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.83.100
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1680x800 [SAR 1:1 DAR 21:10], q=2-31, 1880 kb/s, 24 fps, 24 tbr, 90k tbn, 25 tbc (default)
       Metadata:
         handler_name    : VideoHandler
    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
    Press [q] to stop, [?] for help
    frame=  480 fps= 24 q=-1.0 Lsize=    5009kB time=00:00:19.87 bitrate=2064.7kbits/s speed=   1x
    video:4592kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 9.082929%

    Edit : all the files don’t contain any audio, so it should be even less traffic on the network

  • FFmpeg : unspecified pixel format when opening video with custom context

    14 février 2021, par Pedro

    I am trying to decode a video with a custom context. The purpose is that I want to decode the video directly from memory. In the following code, I am reading from file in the read function passed to avio_alloc_context - but this is just for testing purposes.

    



    I think I've read any post there is on Stackoverflow or on any other website related to this topic. At least I definitely tried my best to do so. While there is much in common, the details differ : people set different flags, some say av_probe_input_format is required, some say it isn't, etc. And for some reason nothing works for me.

    



    My problem is that the pixel format is unspecified (see output below), which is why I run into problems later when calling sws_getContext. I checked pFormatContext->streams[videoStreamIndex]->codec->pix_fmt, and it is -1.

    



    Please note my comments // things I tried and // seems not to help in the code. I think, the answer might be hidden somehwere there. I tried many combinations of hints that I've read so far, but I am missing a detail I guess.

    



    The problem is not the video file, because when I go the standard way and just call avformat_open_input(&pFormatContext, pFilePath, NULL, NULL) without a custom context, everything runs fine.

    



    The code compiles and runs as is.

    



    #include <libavformat></libavformat>avformat.h>&#xA;#include &#xA;#include &#xA;&#xA;FILE *f;&#xA;&#xA;static int read(void *opaque, uint8_t *buf, int buf_size) {&#xA;    if (feof(f)) return -1;&#xA;    return fread(buf, 1, buf_size, f);&#xA;}&#xA;&#xA;int openVideo(const char *pFilePath) {&#xA;    const int bufferSize = 32768;&#xA;    int ret;&#xA;&#xA;    av_register_all();&#xA;&#xA;    f = fopen(pFilePath, "rb");&#xA;    uint8_t *pBuffer = (uint8_t *) av_malloc(bufferSize &#x2B; AVPROBE_PADDING_SIZE);&#xA;    AVIOContext *pAVIOContext = avio_alloc_context(pBuffer, bufferSize, 0, NULL,&#xA;                      &amp;read, NULL, NULL);&#xA;&#xA;    if (!f || !pBuffer || !pAVIOContext) {&#xA;        printf("error: open / alloc failed\n");&#xA;        // cleanup...&#xA;        return 1;&#xA;    }&#xA;&#xA;    AVFormatContext *pFormatContext = avformat_alloc_context();&#xA;    pFormatContext->pb = pAVIOContext;&#xA;&#xA;    const int readBytes = read(NULL, pBuffer, bufferSize);&#xA;&#xA;    printf("readBytes = %i\n", readBytes);&#xA;&#xA;    if (readBytes &lt;= 0) {&#xA;        printf("error: read failed\n");&#xA;        // cleanup...&#xA;        return 2;&#xA;    }&#xA;&#xA;    if (fseek(f, 0, SEEK_SET) != 0) {&#xA;        printf("error: fseek failed\n");&#xA;        // cleanup...&#xA;        return 3;&#xA;    }&#xA;&#xA;    // required for av_probe_input_format&#xA;    memset(pBuffer &#x2B; readBytes, 0, AVPROBE_PADDING_SIZE);&#xA;&#xA;    AVProbeData probeData;&#xA;    probeData.buf = pBuffer;&#xA;    probeData.buf_size = readBytes;&#xA;    probeData.filename = "";&#xA;    probeData.mime_type = NULL;&#xA;&#xA;    pFormatContext->iformat = av_probe_input_format(&amp;probeData, 1);&#xA;&#xA;    // things I tried:&#xA;    //pFormatContext->flags = AVFMT_FLAG_CUSTOM_IO;&#xA;    //pFormatContext->iformat->flags |= AVFMT_NOFILE;&#xA;    //pFormatContext->iformat->read_header = NULL;&#xA;&#xA;    // seems not to help (therefore commented out here):&#xA;    AVDictionary *pDictionary = NULL;&#xA;    //av_dict_set(&amp;pDictionary, "analyzeduration", "8000000", 0);&#xA;    //av_dict_set(&amp;pDictionary, "probesize", "8000000", 0);&#xA;&#xA;    if ((ret = avformat_open_input(&amp;pFormatContext, "", NULL, &amp;pDictionary)) &lt; 0) {&#xA;        char buffer[4096];&#xA;        av_strerror(ret, buffer, sizeof(buffer));&#xA;        printf("error: avformat_open_input failed: %s\n", buffer);&#xA;        // cleanup...&#xA;        return 4;&#xA;    }&#xA;&#xA;    printf("retrieving stream information...\n");&#xA;&#xA;    if ((ret = avformat_find_stream_info(pFormatContext, NULL)) &lt; 0) {&#xA;        char buffer[4096];&#xA;        av_strerror(ret, buffer, sizeof(buffer));&#xA;        printf("error: avformat_find_stream_info failed: %s\n", buffer);&#xA;        // cleanup...&#xA;        return 5;&#xA;    }&#xA;&#xA;    printf("nb_streams = %i\n", pFormatContext->nb_streams);&#xA;&#xA;    // further code...&#xA;&#xA;    // cleanup...&#xA;    return 0;&#xA;}&#xA;&#xA;int main() {&#xA;    openVideo("video.mp4");&#xA;    return 0;&#xA;}&#xA;

    &#xA;&#xA;

    This is the output that I get :
    &#xA;readBytes = 32768
    &#xA;retrieving stream information...
    &#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xdf8d20] stream 0, offset 0x30 : partial file&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xdf8d20] Could not find codec parameters for stream 0 (Video : h264 (avc1 / 0x31637661), none, 640x360, 351 kb/s) : unspecified pixel format
    &#xA;Consider increasing the value for the 'analyzeduration' and 'probesize' options
    &#xA;nb_streams = 2

    &#xA;&#xA;

    UPDATE :
    &#xA;Thanks to WLGfx, here is the solution : The only thing that was missing was the seek function. Apparently, implementing it is mandatory for decoding. It is important to return the new offset - and not 0 in case of success (some solutions found in the web just return the return value of fseek, and that is wrong). Here is the minimal solution that made it work :

    &#xA;&#xA;

    static int64_t seek(void *opaque, int64_t offset, int whence) {&#xA;    if (whence == SEEK_SET &amp;&amp; fseek(f, offset, SEEK_SET) == 0) {&#xA;        return offset;&#xA;    }&#xA;    // handling AVSEEK_SIZE doesn&#x27;t seem mandatory&#xA;    return -1;&#xA;}&#xA;

    &#xA;&#xA;

    Of course, the call to avio_alloc_context needs to be adapted accordingly :

    &#xA;&#xA;

    AVIOContext *pAVIOContext = avio_alloc_context(pBuffer, bufferSize, 0, NULL,&#xA;                      &amp;read, NULL, &amp;seek);&#xA;

    &#xA;