Recherche avancée

Médias (1)

Mot : - Tags -/école

Autres articles (54)

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

Sur d’autres sites (5216)

  • ffmpeg command execution never stops

    19 août 2020, par Khawar Raza

    I am trying to concatenate 3 videos of different resolutions and overlaying 2 videos as transition effects(though the chroma key color removal is not yet implemented) between videos using below command :

    


    ffmpeg 
-i input1.mp4 
-i input2.mp4 
-i input3.mp4 
-i transition1.mp4 
-i transition2.mp4 
-filter_complex 
"[0:v]pad=width=1080:height=1920:x=(1080-iw)*0.5:y=(1920-ih)*0.5:color=black[video0];
[1:v]pad=width=1080:height=1920:x=(1080-iw)*0.5:y=(1920-ih)*0.5:color=black[video1];
[2:v]pad=width=1080:height=1920:x=(1080-iw)*0.5:y=(1920-ih)*0.5:color=black[video2];
[video0][video1][video2]concat=n=3:v=1:a=0[outv];
[3:v]scale=w=1080:h=1920[t0];
[4:v]scale=w=1080:h=1920[t1];
[outv][t0]overlay=enable='between(t,6.6045,9.6335)'[out0];
[out0][t1]overlay=enable='between(t,12.5655,15.6165)'[out1];
[0:a][1:a][2:a]concat=n=3:v=0:a=1[audio]" 
-c:v libx264 -pix_fmt yuv420p -map [out1] -map [audio] -preset ultrafast output.mp4


    


    I get success only with few videos. Most of the times the command execution never stops. It keeps on appending something to the output video file even for hours. Here is the output from console :

    


    ffmpeg version v4.4-dev-416
     Copyright (c) 2000-2020 the FFmpeg developers
      built with Android (6454773 based on r365631c2) clang version 9.0.8 (https://android.googlesource.com/toolchain/llvm-project 98c855489587874b2a325e7a516b99d838599c6f) (based on LLVM 9.0.8svn)
      configuration: --cross-prefix=aarch64-linux-android- --sysroot=/files/android-sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/sysroot --prefix=/home/taner/Projects/mobile-ffmpeg/prebuilt/android-arm64/ffmpeg --pkg-config=/usr/bin/pkg-config --enable-version3 --arch=aarch64 --cpu=armv8-a --cc=aarch64-linux-android24-clang --cxx=aarch64-linux-android24-clang++ --extra-libs='-L/home/taner/Projects/mobile-ffmpeg/prebuilt/android-arm64/cpu-features/lib -lndk_compat' --target-os=android --enable-neon --enable-asm --enable-inline-asm --enable-cross-compile --enable-pic --enable-jni --enable-optimizations --enable-swscale --enable-shared --enable-v4l2-m2m --disable-outdev=fbdev --disable-indev=fbdev --enable-small --disable-openssl --disable-xmm-clobber-test --disable-debug --enable-lto --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-videotoolbox --disable-audiotoolbox --disable-appkit --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gmp --enable-gnutls --enable-libmp3lame --enable-libass --enable-iconv --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxml2 --enable-libopencore-amrnb --enable-libshine --enable-libspeex --enable-libwavpack --enable-libkvazaar --enable-libx264 --enable-gpl --enable-libxvid --enable-gpl --enable-libx265 --enable-gpl --enable-libvidstab --enable-gpl --enable-libilbc --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libaom --enable-libtwolame --disable-sdl2 --enable-libvo-amrwbenc --enable-zlib --enable-mediacodec
      libavutil      56. 55.100 / 56. 55.100
      libavcodec     58. 96.100 / 58. 96.100
      libavformat    58. 48.100 / 58. 48.100
      libavdevice    58. 11.101 / 58. 11.101
      libavfilter     7. 87.100 /  7. 87.100
      libswscale      5.  8.100 /  5.  8.100
      libswresample   3.  8.100 /  3.  8.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input1.mp4':
      Metadata:
        major_brand     : 
    mp42
        minor_version   : 
    0
        compatible_brands: 
isommp42
        creation_time   : 
    2020-08-12T17:21:49.000000Z
        com.android.version: 
    9
      Duration: 
    00:00:08.12
    , start: 
    0.000000
    , bitrate: 
    17298 kb/s
        Stream #0:0
    (eng)
    : Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 16309 kb/s
    , SAR 1:1 DAR 16:9
    , 
    28.70 fps, 
    29.50 tbr, 
    90k tbn, 
    60 tbc
     (default)
        Metadata:
          rotate          : 
    90
          creation_time   : 

          handler_name    : 
    VideoHandle
        Side data:
          
    displaymatrix: rotation of -90.00 degrees
        Stream #0:1
    (eng)
    : Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
     (default)
        Metadata:
          creation_time   : 
    2020-08-12T17:21:49.000000Z
          handler_name    : 
    SoundHandle
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'input2.mp4':
      Metadata:
        major_brand     : 
    isom
        minor_version   : 
    512
        compatible_brands: 
    isomiso2avc1mp41
   encoder         : 
    Lavf57.25.100
      Duration: 
    00:00:05.97
    , start: 
    0.000000
    , bitrate: 
    770 kb/s
        Stream #1:0
    (und)
    : Audio: aac (mp4a / 0x6134706D), 22050 Hz, stereo, fltp, 128 kb/s
     (default)
        Metadata:
          handler_name    : 
    SoundHandler
        Stream #1:1
    (und)
    : Video: h264 (avc1 / 0x31637661), yuv420p, 368x480, 608 kb/s
    , 
    27.29 fps, 
120 tbr, 
    12k tbn, 
    60 tbc
     (default)
        Metadata:
          handler_name    : 
    VideoHandler
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'input3.mp4':
      Metadata:
        major_brand     : 
    isom
        minor_version   : 
    512
    compatible_brands: 
    isomiso2avc1mp41
        encoder         : 
    Lavf55.19.104
      Duration: 
    00:00:13.05
    , start: 
    0.000000
    , bitrate: 
    2453 kb/s
        Chapter #2:0: 
    start 0.000000, 
    end 13.033000
        Metadata:
          title           : 
        Stream #2:0
    (und)
    : Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
     (default)
        Metadata:
          handler_name    : 
    SoundHandler
        Stream #2:1
    (und)
: Video: h264 (avc1 / 0x31637661), yuv420p, 640x480, 2320 kb/s
    , 
    25 fps, 
    25 tbr, 
    1200k tbn, 
    50 tbc
     (default)
        Metadata:
          handler_name    : 
    VideoHandler
        Stream #2:2
    (eng)
    : Data: bin_data (text / 0x74786574), 0 kb/s
        Metadata:
          handler_name    : 
    SubtitleHandler
Input #3, mov,mp4,m4a,3gp,3g2,mj2, from 'transition1.mp4':
      Metadata:
        major_brand     : 
    mp42
        minor_version   : 
    0
        compatible_brands: 
    mp41isom
    creation_time   : 
    2020-08-17T09:31:23.000000Z
      Duration: 
    00:00:03.03
    , start: 
    0.000000
    , bitrate: 
    6263 kb/s
        Stream #3:0
    (und)
    : Video: h264 (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 6307 kb/s
    , 
    30 fps, 
    30 tbr, 
    30k tbn, 
    60 tbc
     (default)
        Metadata:
          creation_time   : 

          handler_name    : 
    VideoHandler
          encoder         : 
    AVC Coding
        Stream #3:1
    (und)
    : Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 79 kb/s
     (default)
        Metadata:
          creation_time   : 
    2020-08-17T09:31:23.000000Z
          handler_name    : 
SoundHandler
Input #4, mov,mp4,m4a,3gp,3g2,mj2, from 'transition2.mp4':
      Metadata:
        major_brand     : 
    mp42
        minor_version   : 0
        compatible_brands: 
    mp41isom
        creation_time   : 
    2020-08-17T09:30:33.000000Z
      Duration: 
    00:00:03.05
    , start: 
    0.000000
    , bitrate: 
    7828 kb/s
        Stream #4:0
    (und)
    : Video: h264 (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 7873 kb/s
    , 
    30 fps, 
30 tbr, 
    30k tbn, 
    60 tbc
     (default)
        Metadata:
          creation_time   : 
    2020-08-17T09:30:33.000000Z
          handler_name    : 
    VideoHandler
          encoder         : 
    AVC Coding
        Stream #4:1
    (und)
    : Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 79 kb/s
     (default)
        Metadata:
          creation_time   : 
    2020-08-17T09:30:33.000000Z
          handler_name    : 
    SoundHandler
Stream mapping:
      Stream #0:0 (h264) -> pad
      Stream #0:1 (aac) -> concat:in0:a0
Stream #1:0 (aac) -> concat:in1:a0
      Stream #1:1 (h264) -> pad
      Stream #2:0 (aac) -> concat:in2:a0
      Stream #2:1 (h264) -> pad
      Stream #3:0 (h264) -> scale
      Stream #4:0 (h264) -> scale
      overlay
     -> Stream #0:0 (libx264)
      concat
     -> Stream #0:1 (aac)
    Press [q] to stop, [?] for help

[graph 0 input from stream 0:0 @ 0x733a19a900] sws_param option is deprecated and ignored
    [graph 0 input from stream 1:1 @ 0x733a19aa80] sws_param option is deprecated and ignored
    [graph 0 input from stream 2:1 @ 0x733a19ab40] sws_param option is deprecated and ignored
    [graph 0 input from stream 3:0 @ 0x733a19ac00] sws_param option is deprecated and ignored
    [graph 0 input from stream 4:0 @ 0x733a19acc0] sws_param option is deprecated and ignored

[mp4 @ 0x733a679400] Frame rate very high for a muxer not efficiently supporting it.
    Please consider specifying a lower framerate, a different muxer or -vsync 2
[libx264 @ 0x733a1b0600] using SAR=1/1
[libx264 @ 0x733a1b0600] MB rate (8160000000) > level limit (16711680)
[libx264 @ 0x733a1b0600] using cpu capabilities: ARMv8 NEON
[libx264 @ 0x733a1b0600] profile Constrained Baseline, level 6.2, 4:2:0, 8-bit
    [libx264 @ 0x733a1b0600] 264 - core 160 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
Output #0, mp4, to 'output.mp4':
      Metadata:
        major_brand     : 
    mp42
minor_version   : 
    0
        compatible_brands: 
    isommp42
        com.android.version: 
    9
        encoder         : 
    Lavf58.48.100
        Chapter #0:0: 
    start 0.000000, 
    end 13.033000
        Metadata:
          title           : 
        Stream #0:0
    : Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 1080x1920 [SAR 1:1 DAR 9:16], q=-1--1
    , 
    1000k tbn, 
    1000k tbc
(default)
        Metadata:
          encoder         : 
    Lavc58.96.100 libx264
        Side data:
          
    cpb: 
    bitrate max/min/avg: 0/0/0 buffer size: 0 
    vbv_delay: N/A
        Stream #0:1
    : Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
     (default)
        Metadata:
          encoder         : 
    Lavc58.96.100 aac
E/Progress: Progress: 3.6918316
D/mobile-ffmpeg: Progress: frame: 1, time: 1002, Pct: 0.036918
frame=    1 fps=0.0 q=0.0 size=       0kB time=00:00:01.00 bitrate=   0.5kbits/s speed=1.79x    
More than 1000 frames duplicated


    


    I even tried command without overlay and audio parts but result was same. I am working on Android app and using below ffmpeg wrapper library :

    


    https://github.com/tanersener/mobile-ffmpeg

    


  • how to stream h.264 video with mp3 audio using libavcodec ?

    29 août 2020, par dasg

    I read h.264 frames from webcamera and capture audio from microphone. I need to stream live video to ffserver. During debug I read video from ffserver using ffmpeg with following command :

    



    ffmpeg -i http://127.0.0.1:12345/robot.avi -vcodec copy -acodec copy out.avi


    



    My video in output file is slightly accelerated. If I add a audio stream it is accelerated several times. Sometimes there is no audio in the output file.

    



    Here is my code for encoding audio :

    



    #include "v_audio_encoder.h"&#xA;&#xA;extern "C" {&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;}&#xA;#include <cassert>&#xA;&#xA;struct VAudioEncoder::Private&#xA;{&#xA;    AVCodec *m_codec;&#xA;    AVCodecContext *m_context;&#xA;&#xA;    std::vector m_outBuffer;&#xA;};&#xA;&#xA;VAudioEncoder::VAudioEncoder( int sampleRate, int bitRate )&#xA;{&#xA;    d = new Private( );&#xA;    d->m_codec = avcodec_find_encoder( CODEC_ID_MP3 );&#xA;    assert( d->m_codec );&#xA;    d->m_context = avcodec_alloc_context3( d->m_codec );&#xA;&#xA;    // put sample parameters&#xA;    d->m_context->channels = 2;&#xA;    d->m_context->bit_rate = bitRate;&#xA;    d->m_context->sample_rate = sampleRate;&#xA;    d->m_context->sample_fmt = AV_SAMPLE_FMT_S16;&#xA;    strcpy( d->m_context->codec_name, "libmp3lame" );&#xA;&#xA;    // open it&#xA;    int res = avcodec_open2( d->m_context, d->m_codec, 0 );&#xA;    assert( res >= 0 );&#xA;&#xA;    d->m_outBuffer.resize( d->m_context->frame_size );&#xA;}&#xA;&#xA;VAudioEncoder::~VAudioEncoder( )&#xA;{&#xA;    avcodec_close( d->m_context );&#xA;    av_free( d->m_context );&#xA;    delete d;&#xA;}&#xA;&#xA;void VAudioEncoder::encode( const std::vector&amp; samples, std::vector&amp; outbuf )&#xA;{&#xA;    assert( (int)samples.size( ) == d->m_context->frame_size );&#xA;&#xA;    int outSize = avcodec_encode_audio( d->m_context, d->m_outBuffer.data( ),&#xA;                                        d->m_outBuffer.size( ), reinterpret_cast<const>( samples.data( ) ) );&#xA;    if( outSize ) {&#xA;        outbuf.resize( outSize );&#xA;        memcpy( outbuf.data( ), d->m_outBuffer.data( ), outSize );&#xA;    }&#xA;    else&#xA;        outbuf.clear( );&#xA;}&#xA;&#xA;int VAudioEncoder::getFrameSize( ) const&#xA;{&#xA;    return d->m_context->frame_size;&#xA;}&#xA;</const></cassert>

    &#xA;&#xA;

    Here is my code for streaming video :

    &#xA;&#xA;

    #include "v_out_video_stream.h"&#xA;&#xA;extern "C" {&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libavutil></libavutil>opt.h>&#xA;#include <libavutil></libavutil>avstring.h>&#xA;#include <libavformat></libavformat>avio.h>&#xA;}&#xA;&#xA;#include <stdexcept>&#xA;#include <cassert>&#xA;&#xA;struct VStatticRegistrar&#xA;{&#xA;    VStatticRegistrar( )&#xA;    {&#xA;        av_register_all( );&#xA;        avformat_network_init( );&#xA;    }&#xA;};&#xA;&#xA;VStatticRegistrar __registrar;&#xA;&#xA;struct VOutVideoStream::Private&#xA;{&#xA;    AVFormatContext * m_context;&#xA;    int m_videoStreamIndex;&#xA;    int m_audioStreamIndex;&#xA;&#xA;    int m_videoBitrate;&#xA;    int m_width;&#xA;    int m_height;&#xA;    int m_fps;&#xA;    int m_bitrate;&#xA;&#xA;    bool m_waitKeyFrame;&#xA;};&#xA;&#xA;VOutVideoStream::VOutVideoStream( int width, int height, int fps, int bitrate )&#xA;{&#xA;    d = new Private( );&#xA;    d->m_width = width;&#xA;    d->m_height = height;&#xA;    d->m_fps = fps;&#xA;    d->m_context = 0;&#xA;    d->m_videoStreamIndex = -1;&#xA;    d->m_audioStreamIndex = -1;&#xA;    d->m_bitrate = bitrate;&#xA;    d->m_waitKeyFrame = true;&#xA;}&#xA;&#xA;bool VOutVideoStream::connectToServer( const std::string&amp; uri )&#xA;{&#xA;    assert( ! d->m_context );&#xA;&#xA;    // initalize the AV context&#xA;    d->m_context = avformat_alloc_context();&#xA;    if( !d->m_context )&#xA;        return false;&#xA;    // get the output format&#xA;    d->m_context->oformat = av_guess_format( "ffm", NULL, NULL );&#xA;    if( ! d->m_context->oformat )&#xA;        return false;&#xA;&#xA;    strcpy( d->m_context->filename, uri.c_str( ) );&#xA;&#xA;    // add an H.264 stream&#xA;    AVStream *stream = avformat_new_stream( d->m_context, NULL );&#xA;    if ( ! stream )&#xA;        return false;&#xA;    // initalize codec&#xA;    AVCodecContext* codec = stream->codec;&#xA;    if( d->m_context->oformat->flags &amp; AVFMT_GLOBALHEADER )&#xA;        codec->flags |= CODEC_FLAG_GLOBAL_HEADER;&#xA;    codec->codec_id = CODEC_ID_H264;&#xA;    codec->codec_type = AVMEDIA_TYPE_VIDEO;&#xA;    strcpy( codec->codec_name, "libx264" );&#xA;//    codec->codec_tag = ( unsigned(&#x27;4&#x27;) &lt;&lt; 24 ) &#x2B; (unsigned(&#x27;6&#x27;) &lt;&lt; 16 ) &#x2B; ( unsigned(&#x27;2&#x27;) &lt;&lt; 8 ) &#x2B; &#x27;H&#x27;;&#xA;    codec->width = d->m_width;&#xA;    codec->height = d->m_height;&#xA;    codec->time_base.den = d->m_fps;&#xA;    codec->time_base.num = 1;&#xA;    codec->bit_rate = d->m_bitrate;&#xA;    d->m_videoStreamIndex = stream->index;&#xA;&#xA;    // add an MP3 stream&#xA;    stream = avformat_new_stream( d->m_context, NULL );&#xA;    if ( ! stream )&#xA;        return false;&#xA;    // initalize codec&#xA;    codec = stream->codec;&#xA;    if( d->m_context->oformat->flags &amp; AVFMT_GLOBALHEADER )&#xA;        codec->flags |= CODEC_FLAG_GLOBAL_HEADER;&#xA;    codec->codec_id = CODEC_ID_MP3;&#xA;    codec->codec_type = AVMEDIA_TYPE_AUDIO;&#xA;    strcpy( codec->codec_name, "libmp3lame" );&#xA;    codec->sample_fmt = AV_SAMPLE_FMT_S16;&#xA;    codec->channels = 2;&#xA;    codec->bit_rate = 64000;&#xA;    codec->sample_rate = 44100;&#xA;    d->m_audioStreamIndex = stream->index;&#xA;&#xA;    // try to open the stream&#xA;    if( avio_open( &amp;d->m_context->pb, d->m_context->filename, AVIO_FLAG_WRITE ) &lt; 0 )&#xA;         return false;&#xA;&#xA;    // write the header&#xA;    return avformat_write_header( d->m_context, NULL ) == 0;&#xA;}&#xA;&#xA;void VOutVideoStream::disconnect( )&#xA;{&#xA;    assert( d->m_context );&#xA;&#xA;    avio_close( d->m_context->pb );&#xA;    avformat_free_context( d->m_context );&#xA;    d->m_context = 0;&#xA;}&#xA;&#xA;VOutVideoStream::~VOutVideoStream( )&#xA;{&#xA;    if( d->m_context )&#xA;        disconnect( );&#xA;    delete d;&#xA;}&#xA;&#xA;int VOutVideoStream::getVopType( const std::vector&amp; image )&#xA;{&#xA;    if( image.size( ) &lt; 6 )&#xA;        return -1;&#xA;    unsigned char *b = (unsigned char*)image.data( );&#xA;&#xA;    // Verify NAL marker&#xA;    if( b[ 0 ] || b[ 1 ] || 0x01 != b[ 2 ] ) {&#xA;        &#x2B;&#x2B;b;&#xA;        if ( b[ 0 ] || b[ 1 ] || 0x01 != b[ 2 ] )&#xA;            return -1;&#xA;    }&#xA;&#xA;    b &#x2B;= 3;&#xA;&#xA;    // Verify VOP id&#xA;    if( 0xb6 == *b ) {&#xA;        &#x2B;&#x2B;b;&#xA;        return ( *b &amp; 0xc0 ) >> 6;&#xA;    }&#xA;&#xA;    switch( *b ) {&#xA;    case 0x65: return 0;&#xA;    case 0x61: return 1;&#xA;    case 0x01: return 2;&#xA;    }&#xA;&#xA;    return -1;&#xA;}&#xA;&#xA;bool VOutVideoStream::sendVideoFrame( std::vector&amp; image )&#xA;{&#xA;    // Init packet&#xA;    AVPacket pkt;&#xA;    av_init_packet( &amp;pkt );&#xA;    pkt.flags |= ( 0 >= getVopType( image ) ) ? AV_PKT_FLAG_KEY : 0;&#xA;&#xA;    // Wait for key frame&#xA;    if ( d->m_waitKeyFrame ) {&#xA;        if( pkt.flags &amp; AV_PKT_FLAG_KEY )&#xA;            d->m_waitKeyFrame = false;&#xA;        else&#xA;            return true;&#xA;    }&#xA;&#xA;    pkt.stream_index = d->m_videoStreamIndex;&#xA;    pkt.data = image.data( );&#xA;    pkt.size = image.size( );&#xA;    pkt.pts = pkt.dts = AV_NOPTS_VALUE;&#xA;&#xA;    return av_write_frame( d->m_context, &amp;pkt ) >= 0;&#xA;}&#xA;&#xA;bool VOutVideoStream::sendAudioFrame( std::vector&amp; audio )&#xA;{&#xA;    // Init packet&#xA;    AVPacket pkt;&#xA;    av_init_packet( &amp;pkt );&#xA;    pkt.stream_index = d->m_audioStreamIndex;&#xA;    pkt.data = audio.data( );&#xA;    pkt.size = audio.size( );&#xA;    pkt.pts = pkt.dts = AV_NOPTS_VALUE;&#xA;&#xA;    return av_write_frame( d->m_context, &amp;pkt ) >= 0;&#xA;}&#xA;</cassert></stdexcept>

    &#xA;&#xA;

    Here is how I use it :

    &#xA;&#xA;

    BOOST_AUTO_TEST_CASE(testSendingVideo)&#xA;{&#xA;    const int framesToGrab = 90000;&#xA;&#xA;    VOutVideoStream stream( VIDEO_WIDTH, VIDEO_HEIGHT, FPS, VIDEO_BITRATE );&#xA;    if( stream.connectToServer( URI ) ) {&#xA;        VAudioEncoder audioEncoder( AUDIO_SAMPLE_RATE, AUDIO_BIT_RATE );&#xA;        VAudioCapture microphone( MICROPHONE_NAME, AUDIO_SAMPLE_RATE, audioEncoder.getFrameSize( ) );&#xA;&#xA;        VLogitecCamera camera( VIDEO_WIDTH, VIDEO_HEIGHT );&#xA;        BOOST_REQUIRE( camera.open( CAMERA_PORT ) );&#xA;        BOOST_REQUIRE( camera.startCapturing( ) );&#xA;&#xA;        std::vector image, encodedAudio;&#xA;        std::vector voice;&#xA;        boost::system_time startTime;&#xA;        int delta;&#xA;        for( int i = 0; i &lt; framesToGrab; &#x2B;&#x2B;i ) {&#xA;            startTime = boost::posix_time::microsec_clock::universal_time( );&#xA;&#xA;            BOOST_REQUIRE( camera.read( image ) );&#xA;            BOOST_REQUIRE( microphone.read( voice ) );&#xA;            audioEncoder.encode( voice, encodedAudio );&#xA;&#xA;            BOOST_REQUIRE( stream.sendVideoFrame( image ) );&#xA;            BOOST_REQUIRE( stream.sendAudioFrame( encodedAudio ) );&#xA;&#xA;            delta = ( boost::posix_time::microsec_clock::universal_time( ) - startTime ).total_milliseconds( );&#xA;            if( delta &lt; 1000 / FPS )&#xA;                boost::thread::sleep( startTime &#x2B; boost::posix_time::milliseconds( 1000 / FPS - delta ) );&#xA;        }&#xA;&#xA;        BOOST_REQUIRE( camera.stopCapturing( ) );&#xA;        BOOST_REQUIRE( camera.close( ) );&#xA;    }&#xA;    else&#xA;        std::cout &lt;&lt; "failed to connect to server" &lt;&lt; std::endl;&#xA;}&#xA;

    &#xA;&#xA;

    I think my problem is in PTS and DTS. Can anyone help me ?

    &#xA;

  • Song name under video

    2 septembre 2020, par ottpeter

    I'm trying to write the song name under the video with ffmpeg. My mp3 files are running in a loop like this :&#xA;-stream_loop -1 -i music.txt&#xA;My workaround would be to write an SRT file with timecodes, a script would determine when next song is comming, and I would repeat this, let's say, a 1000 times (time codes adjusted), then I would get song names for a month for example. (this would be done before ffmpeg is started)&#xA;Obviously this is not optimal, especially because I can't loop the SRT file as well, because of the timecode. It would be better to do this with a filter complex.

    &#xA;

    Is there a way to know the name of the mp3 that is currently playing, in ffmpeg ?

    &#xA;