Recherche avancée

Médias (29)

Mot : - Tags -/Musique

Autres articles (44)

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

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

  • Les sons

    15 mai 2013, par

Sur d’autres sites (4414)

  • FFMPEG is really slow at extracting subtitles

    3 mars 2021, par Gustav P Svensson

    I'm trying to extract the subtitles from a 1080P video, around 40min long. I'm currently using this command (using fluent-ffmpeg in node, but the translated command is this) :

    


    ffmpeg -threads 3  -map 0: -c copy 


    


    This command takes about 20-30 min to complete. I've searched quite a lot on how to speed up this process, if I look at my task manager I can see that ffmpeg is using 0.1% of the CPU which makes me think that it's possible to speed up this process.

    


    I'm not sure if the -threads option is actually doing anything when extracting subtitles but I don't think it should make it slower atleast ?

    


    So my question is, is it possible to speed up this process ? I appriciate any help.

    


    Full FFMPEG log:
fmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  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
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, matroska,webm, from '/home/test.mkv:
  Metadata:
    encoder         : libebml v1.3.6 + libmatroska v1.4.9
    creation_time   : 2019-03-14T16:46:55.000000Z
  Duration: 00:41:20.29, start: 0.000000, bitrate: 6430 kb/s
    Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Metadata:
      BPS-eng         : 5788926
      DURATION-eng    : 00:41:20.020000000
      NUMBER_OF_FRAMES-eng: 59461
      NUMBER_OF_BYTES-eng: 1794581562
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-14 16:46:55
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(eng): Audio: eac3, 48000 Hz, 5.1(side), fltp, 640 kb/s (default)
    Metadata:
      title           : English
      BPS-eng         : 640000
      DURATION-eng    : 00:41:20.288000000
      NUMBER_OF_FRAMES-eng: 77509
      NUMBER_OF_BYTES-eng: 198423040
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-14 16:46:55
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:2(eng): Subtitle: subrip
    Metadata:
      BPS-eng         : 80
      DURATION-eng    : 00:40:22.295000000
      NUMBER_OF_FRAMES-eng: 645
      NUMBER_OF_BYTES-eng: 24473
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-14 16:46:55
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:3(eng): Subtitle: subrip
    Metadata:
      title           : SDH
      BPS-eng         : 86
      DURATION-eng    : 00:40:31.012000000
      NUMBER_OF_FRAMES-eng: 709
      NUMBER_OF_BYTES-eng: 26142
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-14 16:46:55
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Output #0, srt, to 'test6.srt':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0(eng): Subtitle: subrip
    Metadata:
      BPS-eng         : 80
      DURATION-eng    : 00:40:22.295000000
      NUMBER_OF_FRAMES-eng: 645
      NUMBER_OF_BYTES-eng: 24473
      _STATISTICS_WRITING_APP-eng: mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2019-03-14 16:46:55
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
  Stream #0:2 -> #0:0 (copy)
Press [q] to stop, [?] for help
size=      46kB time=00:40:36.68 bitrate=   0.2kbits/s speed=11.6x    
video:0kB audio:0kB subtitle:24kB other streams:0kB global headers:0kB muxing overhead: 94.438766%


    


  • ffmpeg does not decode some h264 streams

    12 janvier 2016, par Andrey

    I have some ip of cameras on the local network.I receive video stream with live555 library (I took testRtspClient as a basis) and decode frames with ffmpeg (avcodec_decode_video2). Everything perfectly works.
    Problems begin when I try to decode a stream from an internet.

    The first problem - some packets lost, so defects appears. But it’s not a problem. Problem - after stop and start video stream it is necessary to wait for about 5 minutes of streaming before ffmpeg is able to decode something from the same ip camera. If packets doesn’t lost then everithing ok.

    The second problem - there is camera which sends video with resolution 2048х1538. The frame of such resolution is sent by several packets. live555 normally brings together them but when the frame is transferred to the decoder, the decoder returns the packet length, but got frame always 0.

    Here some my code :

    #define RECEIVE_BUFFER_SIZE 1000000
    AVCodecContext* avCodecContext; //definition
    AVFrame *frame;  //definition
    ...
    //init code
    _fReceiveBuffer = new uint8_t[RECEIVE_BUFFER_SIZE+512]; //buffer to receive frame
    ZeroMemory(_fReceiveBuffer, RECEIVE_BUFFER_SIZE + 512); //zeros
    _bufferSize = RECEIVE_BUFFER_SIZE * sizeof(uint8_t); //buffer size

    static const  uint8_t startCode[4] = { 0x00, 0x00, 0x00, 0x01 }; //this is for 0 0 0 1
    //before frame will transfer to decoder
    memcpy(_fReceiveBuffer, (void*)startCode, sizeof(uint8_t)* 4);
    _fReceiveBuffer += sizeof(sizeof(uint8_t)* 4);
    _bufferSize -= sizeof(sizeof(uint8_t)* 4);

    AVCodec *codec = avcodec_find_decoder(AV_CODEC_ID_H264); //find codec

    avCodecContext = avcodec_alloc_context3(codec);
    avCodecContext->flags |= AV_PKT_FLAG_KEY;
    avcodec_open2(avCodecContext, codec, NULL);

    frame = av_frame_alloc();

    //frame
    void DummySink::afterGettingFrame(unsigned frameSize, unsigned numTruncatedBytes,
    struct timeval presentationTime, unsigned durationInMicroseconds) {

    if (strcmp(fSubsession.codecName(), "H264") == 0)
    {
       //code from onvif device manager
       static const uint8_t startCode3[] = { 0x00, 0x00, 0x01 };
       static const uint8_t startCode4[] = { 0x00, 0x00, 0x00, 0x01 };
       auto correctedFrameSize = frameSize;
       auto correctedBufferPtr = fPlObj->_fReceiveBuffer;
       if (frameSize < sizeof(startCode4) || memcmp(startCode4, correctedBufferPtr, sizeof(startCode4)) != 0){
           if (frameSize < sizeof(startCode3) || memcmp(startCode3, correctedBufferPtr, sizeof(startCode3)) != 0){
               correctedFrameSize += sizeof(uint8_t)* 4;
               correctedBufferPtr -= sizeof(uint8_t)* 4;
           }
       }

       ProcessFrame(correctedBufferPtr, correctedFrameSize, presentationTime, durationInMicroseconds);
    }
    continuePlaying();
    }

    void DummySink::ProcessFrame(unsigned char* framePtr, int frameSize, struct timeval presentationTime, unsigned duration)    {

    AVPacket avpkt;
    av_init_packet(&avpkt);
    avpkt.data = framePtr;
    avpkt.size = frameSize;
    while (avpkt.size > 0) {
       int got_frame = 0;

       int len = avcodec_decode_video2(avCodecContext, frame, &got_frame, &avpkt);
       if (len < 0) {
           //TODO: log error
           return;
       }
       else if (got_frame == 0)
       {
    //I tried this code, bacause "codecs which have the AV_CODEC_CAP_DELAY capability set have a delay between input and output"
    //but it didn't help
           /*AVPacket emptyPacket;
           av_init_packet(&emptyPacket);
           emptyPacket.data = NULL;
           emptyPacket.size = 0;
           emptyPacket.stream_index = avpkt.stream_index;
           len = avcodec_decode_video2(avCodecContext, frame, &got_frame, &emptyPacket);
           if ( got_frame == 1) goto next;*/
           return;
       }
    next:
       //... here code for view with DirectDraw - everithing ok with it
       avpkt.size -= len;
       avpkt.data += len;
    }
    }

    I alsa tried to send frame to decoder with sps and pps information :

    0 0 0 1 sps 0 0 0 1 pps 0 0 0 1 frame

    but it is not help.

    Interesting that avcodec_decode_video2 does not return frame with second problem (return all size of frame), but width and height in avCodecContext are set correctly. I can’t understart why it doesn’t return frame.

    Can anyone help with these problems ?

  • Synchronizing RTSP signals with FFMPEG

    3 décembre 2019, par Taits

    I have achieved to merge two RTSP signals in one with FFMPEG but in the resulting stream, the first input has a delay of between 2 and 5 seconds with respect to the second. And it is always the first input that is delayed compared to the second.

    The two RTSP signals come from the same camera model, same configuration, same room ...

    However, if I put the same RTSP signal (either of the two) as input 1 and input 2, the same thing happens. Despite being the same signal, the first input is delayed compared to the second one.

    How could I get them synchronized ?

    This is the command that I execute :

    ffmpeg -rtsp_transport tcp -thread_queue_size 512 -rtbufsize 50M -r 15
    -i rtsp://XXXX -rtsp_transport tcp -thread_queue_size 512 -rtbufsize 50M -r 15
    -c:a aac -i rtsp://YYYY -filter_complex "[0:v]pad=iw*2:ih,setpts=PTS-STARTPTS[bg];
    [1:v]setpts=PTS-STARTPTS[fg]; [bg][fg]overlay=w[out]" -map "[out]" -f hls
    -hls_time 2 -hls_list_size 5 -use_localtime 1 -use_localtime_mkdir 1
    -hls_segment_filename 'LIVE/file-%s.ts' -map a -ar 16000 -ac 1 -ab 64000 -c:a aac
    -y output.m3u8

    Here you have the process informationn :

    ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers
    built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
    configuration: --prefix=/usr/local/Cellar/ffmpeg/3.4.2 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --disable-jack --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
     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
     libavresample   3.  7.  0 /  3.  7.  0
     libswscale      4.  8.100 /  4.  8.100
     libswresample   2.  9.100 /  2.  9.100
     libpostproc    54.  7.100 / 54.  7.100
    [rtsp @ 0x7fe284000e00] Missing PPS in sprop-parameter-sets, ignoring
    Input #0, rtsp, from 'rtsp://XXXX':
     Metadata:
       title           : Media Presentation
     Duration: N/A, start: 0.000000, bitrate: N/A
       Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1280x720, 15 fps, 15 tbr, 90k tbn, 30 tbc
       Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
    [rtsp @ 0x7fe28484de00] Missing PPS in sprop-parameter-sets, ignoring
    Input #1, rtsp, from 'rtsp://XXXX':
     Metadata:
       title           : Media Presentation
     Duration: N/A, start: 0.000000, bitrate: N/A
       Stream #1:0: Video: h264 (Main), yuv420p(progressive), 1280x720, 15 fps, 15 tbr, 90k tbn, 30 tbc
       Stream #1:1: Audio: aac (LC), 16000 Hz, mono, fltp
    Stream mapping:
     Stream #0:0 (h264) -> pad (graph 0)
     Stream #1:0 (h264) -> setpts (graph 0)
     overlay (graph 0) -> Stream #0:0 (libx264)
     Stream #0:1 -> #0:1 (aac (native) -> aac (native))
    Press [q] to stop, [?] for help
    [libx264 @ 0x7fe286802000] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
    [libx264 @ 0x7fe286802000] profile High, level 4.0
    [libx264 @ 0x7fe286802000] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=1 weightp=2 keyint=250 keyint_min=15 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    [hls @ 0x7fe286800000] Opening 'LIVE/file-1524728763.ts' for writing
    Output #0, hls, to 'output.m3u8':
     Metadata:
       title           : Media Presentation
       encoder         : Lavf57.83.100
       Stream #0:0: Video: h264 (libx264), yuv420p, 2560x720, q=-1--1, 15 fps, 90k tbn, 15 tbc (default)
       Metadata:
         encoder         : Lavc57.107.100 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
       Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp, 64 kb/s
       Metadata:
         encoder         : Lavc57.107.100 aac
    [hls @ 0x7fe286800000] Opening 'LIVE/file-1524728782.ts' for writinged=1.09x    
    [hls @ 0x7fe286800000] Opening 'output.m3u8.tmp' for writing
    [hls @ 0x7fe286800000] Opening 'output.m3u8.tmp' for writing=N/A speed=1.07x    
    frame=  396 fps= 15 q=-1.0 Lsize=N/A time=00:00:27.00 bitrate=N/A speed=1.05x    
    video:2946kB audio:147kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown