Recherche avancée

Médias (2)

Mot : - Tags -/map

Autres articles (53)

  • 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

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

Sur d’autres sites (11037)

  • Unknown V4L2 pixel format equivalent for yuva420p with ffmpeg and v4l2loopback

    7 février 2019, par Kim

    I am trying to use filter_complex from ffmpeg to stich several video input together into one output.

    I use v4l2loopback to create a virtual video device :

    sudo modprobe v4l2loopback video_nr=90

    In this example, i first try with only one camera :

    v4l2-ctl --device=/dev/video0 --info gives the following output :

    Driver Info (not using libv4l2):
           Driver name   : uvcvideo
           Card type     : HD USB Camera
           Bus info      : usb-0000:00:14.0-13.2
           Driver version: 4.10.17
           Capabilities  : 0x84200001
                   Video Capture
                   Streaming
                   Extended Pix Format
                   Device Capabilities
           Device Caps   : 0x04200001
                   Video Capture
                   Streaming
                   Extended Pix Format
    Priority: 2
    Video input : 0 (Camera 1: ok)
    Format Video Capture:
           Width/Height      : 640/480
           Pixel Format      : 'YUYV'
           Field             : None
           Bytes per Line    : 1280
           Size Image        : 614400
           Colorspace        : sRGB
           Transfer Function : Default
           YCbCr Encoding    : Default
           Quantization      : Default
           Flags             :
    Crop Capability Video Capture:
           Bounds      : Left 0, Top 0, Width 640, Height 480
           Default     : Left 0, Top 0, Width 640, Height 480
           Pixel Aspect: 1/1
    Selection: crop_default, Left 0, Top 0, Width 640, Height 480
    Selection: crop_bounds, Left 0, Top 0, Width 640, Height 480
    Streaming Parameters Video Capture:
           Capabilities     : timeperframe
           Frames per second: 30.000 (30/1)
           Read buffers     : 0
                        brightness (int)    : min=0 max=15 step=1 default=8 value=8
                          contrast (int)    : min=0 max=15 step=1 default=8 value=8
                        saturation (int)    : min=0 max=15 step=1 default=7 value=7
                               hue (int)    : min=-10 max=10 step=1 default=0value=0
    white_balance_temperature_auto (bool)   : default=1 value=1
                             gamma (int)    : min=1 max=10 step=1 default=7 value=7
                              gain (int)    : min=0 max=0 step=0 default=0 value=0
              power_line_frequency (menu)   : min=0 max=2 default=2 value=2
         white_balance_temperature (int)    : min=2800 max=6500 step=1 default=2800 value=2800 flags=inactive
                         sharpness (int)    : min=0 max=15 step=1 default=6 value=6
            backlight_compensation (int)    : min=0 max=1 step=1 default=0 value=0
                     exposure_auto (menu)   : min=0 max=3 default=3 value=3
                 exposure_absolute (int)    : min=4 max=5000 step=1 default=625 value=625 flags=inactive
                    focus_absolute (int)    : min=0 max=21 step=1 default=16 value=16 flags=inactive
                        focus_auto (bool)   : default=1 value=1

    Then i use this command to ouput /dev/video0 to /dev/video90 on the left side with a specific resolution :

    ffmpeg -loglevel verbose -y \
     -f v4l2 -thread_queue_size 512 -i /dev/video0 \
     -filter_complex "nullsrc=size=960x240 [base]; \
             [0:v] format=pix_fmts=yuva420p, setpts=PTS-STARTPTS, scale=320x240 [left]; \
             [base][left] overlay=shortest=1" \
     -f v4l2 /dev/video90

    Which results in the following error :

    [v4l2 @ 0x55fa67d02f60] Unknown V4L2 pixel format equivalent for yuva420p
    Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
    Error initializing output stream 0:0 --
    Conversion failed!

    Full logs :

    ffmpeg version 3.4.4-1~16.04.york0 Copyright (c) 2000-2018 the FFmpeg developers
     built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
     configuration: --prefix=/usr --extra-version='1~16.04.york0' --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
     WARNING: library configuration mismatch
     avcodec     configuration: --prefix=/usr --extra-version='1~16.04.york0'--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 --enable-version3 --disable-doc --disable-programs --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc
     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
    [video4linux2,v4l2 @ 0x55fa67cfca00] fd:5 capabilities:84200001
    [video4linux2,v4l2 @ 0x55fa67cfca00] Querying the device for the current frame size
    [video4linux2,v4l2 @ 0x55fa67cfca00] Setting frame size to 640x480
    Input #0, video4linux2,v4l2, from '/dev/video0':
     Duration: N/A, start: 273229.829138, bitrate: 147456 kb/s
       Stream #0:0: Video: rawvideo, 1 reference frame (YUY2 / 0x32595559), yuyv422, 640x480, 147456 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
    [Parsed_nullsrc_0 @ 0x55fa67d00680] size:960x240 rate:25/1 duration:-1.000000 sar:1/1
    [Parsed_scale_3 @ 0x55fa67d02240] w:320 h:240 flags:'bilinear' interl:0
    Stream mapping:
     Stream #0:0 (rawvideo) -> format
     overlay -> Stream #0:0 (rawvideo)
    Press [q] to stop, [?] for help
    [Parsed_nullsrc_0 @ 0x55fa67cfc760] size:960x240 rate:25/1 duration:-1.000000 sar:1/1
    [Parsed_scale_3 @ 0x55fa67d055c0] w:320 h:240 flags:'bilinear' interl:0
    [graph 0 input from stream 0:0 @ 0x55fa67d06a40] w:640 h:480 pixfmt:yuyv422 tb:1/1000000 fr:30/1 sar:0/1 sws_param:flags=2
    [auto_scaler_0 @ 0x55fa67d05d80] w:iw h:ih flags:'bilinear' interl:0
    [Parsed_format_1 @ 0x55fa67d04360] auto-inserting filter 'auto_scaler_0' between the filter 'graph 0 input from stream 0:0' and the filter 'Parsed_format_1'
    [auto_scaler_0 @ 0x55fa67d05d80] w:640 h:480 fmt:yuyv422 sar:0/1 -> w:640 h:480 fmt:yuva420p sar:0/1 flags:0x2
    [Parsed_format_1 @ 0x55fa67d04360] TB:0.000001 FRAME_RATE:30.000000 SAMPLE_RATE:nan
    [Parsed_scale_3 @ 0x55fa67d055c0] w:640 h:480 fmt:yuva420p sar:0/1 -> w:320 h:240 fmt:yuva420p sar:0/1 flags:0x2
    [Parsed_overlay_4 @ 0x55fa67d05e80] main w:960 h:240 fmt:yuva420p overlay w:320 h:240 fmt:yuva420p
    [Parsed_overlay_4 @ 0x55fa67d05e80] [framesync @ 0x55fa67d05fa8] Selected 1/1000000 time base
    [Parsed_overlay_4 @ 0x55fa67d05e80] [framesync @ 0x55fa67d05fa8] Sync level 2
    [v4l2 @ 0x55fa67d02f60] Unknown V4L2 pixel format equivalent for yuva420p
    Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
    Error initializing output stream 0:0 --
    Conversion failed!

    What I tried and didn’t work :

    • use -f h264 for the output, which ends in a av_interleaved_write_frame(): Invalid argument error
  • ffmpeg, v4l, snd_aloop ... sound asyncron (alsa buffer xrun)

    28 janvier 2019, par Tobias

    I’m trying to create a stream that automatically reloads random inputs. I would like to extend this to a database later.

    Each time ffmpeg finishes and starts again, so the input changes, the connection to the rtmp is interrupted briefly causing the whole connection breaks down. I then tried to separate audio and video, to send them to virtual devices and read from there again. Split the stream on virtual devices, reassemble them directly and send them to rtmp. If the input is then exchanged, the sending to the devices interrupts what does not bother the second ffmpeg. As soon as I stop sending to the devices the fps go very slowly (10 - 20 sec) from 25 to 0. Only then does the transmitter ffmpeg break the connection to the rtmp. The script which exchanges the inputs needs only one second. A practical test showed that everything works as desired.

    I can quite comfortably change the input while the second ffmpeg maintains the stream ...

    The joy did not last long. The sound is good 1 sec delayed. But sporadically. Sometimes everything works great. Sometimes the sound is offset.

    I wrote several scripts for this.

    Background :

    1. File is selected by random
    2. Media file is split and written to / dev / video0 (v4l loopback) and alsa default (snd_aloop loopback)
    3. Put the splits together again and stream them to a rtmp server

    Code that selects the input and sends to / dev / video0 and alsa default

    #!/bin/bash

    cat /dev/null > log

    while true;
    do

     WATERMARK="watermark.png";
     dir='/homeXXXXXXXXXX/mix'
     file=`/bin/ls -1 "$dir" | sort --random-sort | head -1`
     DATEI=`readlink --canonicalize "$dir/$file"` # Converts to full path

    if [ -z $DATEI ]
    then
     echo "Keine Datei gefunden" >> log;
    else
     START=$(date +%s);
     echo "Sende $DATEI" >> log;
     ffmpeg -re -y -i "$DATEI" -c:v libx264 -vf "fps=25,scale=640:480,setdar=4:3" -async 1 -pix_fmt yuv420p -preset ultrafast -map 0:0 -f v4l2 -vcodec rawvideo /dev/video0 -f alsa default
    fi

    DOKILL=`cat kill`;
    if [ "$DOKILL" = "1"]
    then
     break;
    fi

    done

    The Output

    ./run.sh
    ffmpeg version 3.2.12-1~deb9u1 Copyright (c) 2000-2018 the FFmpeg developers
     built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
     configuration: --prefix=/usr --extra-version='1~deb9u1' --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-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --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-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
     libavutil      55. 34.101 / 55. 34.101
     libavcodec     57. 64.101 / 57. 64.101
     libavformat    57. 56.101 / 57. 56.101
     libavdevice    57.  1.100 / 57.  1.100
     libavfilter     6. 65.100 /  6. 65.100
     libavresample   3.  1.  0 /  3.  1.  0
     libswscale      4.  2.100 /  4.  2.100
     libswresample   2.  3.100 /  2.  3.100
     libpostproc    54.  1.100 / 54.  1.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/mix/XXXXXXXXXXXXX.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       title           : XXXXXXXXXXXXXXX

       encoder         : Lavf57.41.100
     Duration: 00:03:53.48, start: 0.000000, bitrate: 2705 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 2573 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
    Codec AVOption preset (Configuration preset) specified for output file #0 (/dev/video0) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
    [Parsed_setdar_2 @ 0x5571234fe020] num:den syntax is deprecated, please use num/den or named options instead
    -async is forwarded to lavfi similarly to -af aresample=async=1:min_hard_comp=0.100000:first_pts=0.
    Output #0, v4l2, to '/dev/video0':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       title           : XXXXXXXXXXX

       encoder         : Lavf57.56.101
       Stream #0:0(und): Video: rawvideo (I420 / 0x30323449), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc (default)
       Metadata:
         handler_name    : VideoHandler
         encoder         : Lavc57.64.101 rawvideo
    Output #1, alsa, to 'default':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       title           : XXXXXXXXXX

       encoder         : Lavf57.56.101
       Stream #1:0(und): Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
         encoder         : Lavc57.64.101 pcm_s16le
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
     Stream #0:1 -> #1:0 (aac (native) -> pcm_s16le (native))
    Press [q] to stop, [?] for help
    frame=  736 fps= 24 q=-0.0 Lsize=N/A time=00:00:29.67 bitrate=N/A speed=0.979x    
    video:331200kB audio:5112kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
    Exiting normally, received signal 2.

    The send script

    #!/bin/bash

    IP="XXXXXXXXX";

    ffmpeg -f video4linux2 -i /dev/video0 -f alsa -acodec pcm_s16le -i default -f flv -async 1 -pix_fmt yuv420p -preset ultrafast -vcodec libx264 -r 25 -s 640x260 -acodec aac rtmp://$IP:1935/live/test

    The Output

    ./send_stream.sh
    ffmpeg version 3.2.12-1~deb9u1 Copyright (c) 2000-2018 the FFmpeg developers
     built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
     configuration: --prefix=/usr --extra-version='1~deb9u1' --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-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --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-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
     libavutil      55. 34.101 / 55. 34.101
     libavcodec     57. 64.101 / 57. 64.101
     libavformat    57. 56.101 / 57. 56.101
     libavdevice    57.  1.100 / 57.  1.100
     libavfilter     6. 65.100 /  6. 65.100
     libavresample   3.  1.  0 /  3.  1.  0
     libswscale      4.  2.100 /  4.  2.100
     libswresample   2.  3.100 /  2.  3.100
     libpostproc    54.  1.100 / 54.  1.100
    Input #0, video4linux2,v4l2, from '/dev/video0':
     Duration: N/A, start: 1548393682.674066, bitrate: 110592 kb/s
       Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 640x480, 110592 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
    Guessed Channel Layout for Input Stream #1.0 : stereo
    Input #1, alsa, from 'default':
     Duration: N/A, start: 1548393682.677901, bitrate: 1536 kb/s
       Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
    -async is forwarded to lavfi similarly to -af aresample=async=1:min_hard_comp=0.100000:first_pts=0.
    [libx264 @ 0x55e22cfa4f00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    [libx264 @ 0x55e22cfa4f00] profile Constrained Baseline, level 2.1
    [libx264 @ 0x55e22cfa4f00] 264 - core 148 r2748 97eaef2 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=6 lookahead_threads=1 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, flv, to 'rtmp://XXXXXXXXXXX:1935/live/test':
     Metadata:
       encoder         : Lavf57.56.101
       Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 640x260, q=-1--1, 25 fps, 1k tbn, 25 tbc
       Metadata:
         encoder         : Lavc57.64.101 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
       Stream #0:1: Audio: aac (LC) ([10][0][0][0] / 0x000A), 48000 Hz, stereo, fltp, 128 kb/s
       Metadata:
         encoder         : Lavc57.64.101 aac
    Stream mapping:
     Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
     Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
    Press [q] to stop, [?] for help
    [alsa @ 0x55e22cf87300] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
    [video4linux2,v4l2 @ 0x55e22cf84fe0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
    Past duration 0.613319 too large    7344kB time=00:01:05.85 bitrate= 913.5kbits/s speed=1.04x    
    Past duration 0.614372 too large    7644kB time=00:01:08.39 bitrate= 915.6kbits/s speed=1.04x    
    Past duration 0.609749 too large    7834kB time=00:01:10.91 bitrate= 905.0kbits/s speed=1.04x    
    Past duration 0.604362 too large    8038kB time=00:01:12.92 bitrate= 903.0kbits/s speed=1.04x    
    Past duration 0.609489 too large    8070kB time=00:01:13.45 bitrate= 900.1kbits/s speed=1.04x    
    Past duration 0.615013 too large    8094kB time=00:01:13.94 bitrate= 896.8kbits/s speed=1.04x    
    Past duration 0.610893 too large    8179kB time=00:01:14.94 bitrate= 894.0kbits/s speed=1.04x    
    Past duration 0.664711 too large
    Past duration 0.639565 too large    8263kB time=00:01:15.47 bitrate= 896.8kbits/s speed=1.04x    
    Past duration 0.668999 too large    8339kB time=00:01:15.94 bitrate= 899.5kbits/s speed=1.04x    
    Past duration 0.605766 too large
    Past duration 0.633049 too large    8399kB time=00:01:16.48 bitrate= 899.6kbits/s speed=1.04x    
    Past duration 0.674599 too large
    Past duration 0.616035 too large    8451kB time=00:01:16.95 bitrate= 899.7kbits/s speed=1.04x    
    Past duration 0.656136 too large
    Past duration 0.604195 too large
    Past duration 0.601387 too large    8512kB time=00:01:17.46 bitrate= 900.2kbits/s speed=1.04x    
    Past duration 0.621895 too large    8565kB time=00:01:17.95 bitrate= 900.1kbits/s speed=1.04x    
    Past duration 0.670937 too large    8605kB time=00:01:18.46 bitrate= 898.4kbits/s speed=1.04x    
    Past duration 0.604500 too large    8642kB time=00:01:18.99 bitrate= 896.2kbits/s speed=1.04x    
    frame= 1913 fps= 25 q=-1.0 Lsize=    8670kB time=00:01:19.48 bitrate= 893.6kbits/s speed=1.04x    
    video:7290kB audio:1280kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.160292%
    [libx264 @ 0x55e22cfa4f00] frame I:8     Avg QP:18.25  size: 15502
    [libx264 @ 0x55e22cfa4f00] frame P:1905  Avg QP:20.95  size:  3853
    [libx264 @ 0x55e22cfa4f00] mb I  I16..4: 100.0%  0.0%  0.0%
    [libx264 @ 0x55e22cfa4f00] mb P  I16..4:  6.4%  0.0%  0.0%  P16..4: 38.1%  0.0%  0.0%  0.0%  0.0%    skip:55.5%
    [libx264 @ 0x55e22cfa4f00] coded y,uvDC,uvAC intra: 46.0% 30.3% 13.4% inter: 20.1% 9.8% 1.1%
    [libx264 @ 0x55e22cfa4f00] i16 v,h,dc,p: 47% 34% 10%  9%
    [libx264 @ 0x55e22cfa4f00] i8c dc,h,v,p: 45% 28% 22%  5%
    [libx264 @ 0x55e22cfa4f00] kb/s:750.98
    [aac @ 0x55e22cfa62a0] Qavg: 579.067
    Exiting normally, received signal 2.

    First everything is fine and then comes

    Past duration 0.616035 too large    8451kB time=00:01:16.95 bitrate= 899.7kbits/s speed=1.04x    
    Past duration 0.656136 too large
    Past duration 0.604195 too large
    Past duration 0.601387 too large    8512kB time=00:01:17.46 bitrate= 900.2kbits/s speed=1.04x

    And then when that comes, dives in the first window, so in the ffmpeg sends the input :

    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
     Stream #0:1 -> #1:0 (aac (native) -> pcm_s16le (native))
    Press [q] to stop, [?] for help
    frame=    9 fps=0.0 q=-0.0 size=N/A time=00:00:00.36 bitrate=N/A dup=1 drop=0 spframe=   21 fps= 21 q=-0.0 size=N/A time=00:00:00.84 bitrate=N/A dup=1 drop=0 sp[alsa @ 0x5643b3293160] ALSA buffer xrun.
       Last message repeated 1 times
    frame=   33 fps= 22 q=-0.0 size=N/A time=00:00:01.32 bitrate=N/A dup=1 drop=0 sp[alsa @ 0x5643b3293160] ALSA buffer xrun.
       Last message repeated 1 times
    frame=   46 fps= 23 q=-0.0 size=N/A time=00:00:01.84 bitrate=N/A dup=1 drop=0 spframe=   58 fps= 23 q=-0.0 size=N/A time=00:00:02.32 bitrate=N/A dup=1 drop=0 spframe=   71 fps= 24 q=-0.0 size=N/A time=00:00:02.84 bitrate=N/A dup=1 drop=0 spframe=   83 fps= 24 q=-0.0 size=N/A time=00:00:03.32 bitrate=N/A dup=1 drop=0 sp[alsa @ 0x5643b3293160] ALSA buffer xrun.
    frame=   96 fps= 24 q=-0.0 size=N/A time=00:00:03.84 bitrate=N/A dup=1 drop=0 sp[alsa @ 0x5643b3293160] ALSA buffer xrun.

    The sound is then absolutely unsynchronized ...

    Does anyone have any advice and can help me ?

  • Concatenating slideshows and normal videos causes audio bleeding

    28 janvier 2019, par Zurechtweiser

    I noticed audio bleeding with concatenated videos containing alternating slideshows and normal videos.

    My commands

    ffmpeg -y -ss 00:00:04.391 -to 00:02:17.171 -i "test.MP4" -r 60 -c:v libx264 -af afade=t=in:ss=0:d=1,afade=t=out:st='00\:02\:11.780':d=1 25.mp4
    ffmpeg -y -i 25.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts 25f.ts

    ffmpeg -y -loop 1 -i "test.JPG" -t 2 -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -shortest -r 60 -c:v libx264 -c:a aac -pix_fmt yuv420p -vf scale=-2:1080,pad=width=1920:height=1080:x=240:y=0:color=black 26.mp4
    ffmpeg -y -i 26.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts 26f.ts

    ffmpeg -y -i "concat:25f.ts|26f.ts" -bsf:a aac_adtstoasc -movflags faststart -c copy "final.mp4"

    The rest of audio of test.MP4 bleeds into the beginning of the test.JPG-single frame slideshow.

    I presumed a different framerate to cause it, but adding -r 60 didn’t solve the issue.

    Also it seems that the video player interpretes the final video as a set of single videos, as whenever a "new" video shows up, it stutters slightly and loses framerate.

    How do I concat them without bleeding and create a final video without stuttering ?

    ffprobe -show_streams 25.mp4 :

    ffprobe version N-92246-gc2ac3b8e6a Copyright (c) 2007-2018 the FFmpeg developers
     built with gcc 8.2.1 (GCC) 20181017
     configuration: --enable-gpl --enable-version3 --enable-sdl2 --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. 19.101 / 56. 19.101
     libavcodec     58. 33.102 / 58. 33.102
     libavformat    58. 19.102 / 58. 19.102
     libavdevice    58.  4.106 / 58.  4.106
     libavfilter     7. 37.100 /  7. 37.100
     libswscale      5.  2.100 /  5.  2.100
     libswresample   3.  2.100 /  3.  2.100
     libpostproc    55.  2.100 / 55.  2.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '25.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf58.19.102
     Duration: 00:00:12.65, start: 0.000000, bitrate: 2040 kb/s
       Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1215:1216 DAR 135:76], 1903 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default)
       Metadata:
         handler_name    : VideoHandle
       Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
       Metadata:
         handler_name    : SoundHandle
    [STREAM]
    index=0
    codec_name=h264
    codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
    profile=High
    codec_type=video
    codec_time_base=1/120
    codec_tag_string=avc1
    codec_tag=0x31637661
    width=1920
    height=1080
    coded_width=1920
    coded_height=1088
    has_b_frames=2
    sample_aspect_ratio=1215:1216
    display_aspect_ratio=135:76
    pix_fmt=yuv420p
    level=42
    color_range=unknown
    color_space=unknown
    color_transfer=unknown
    color_primaries=unknown
    chroma_location=left
    field_order=unknown
    timecode=N/A
    refs=1
    is_avc=true
    nal_length_size=4
    id=N/A
    r_frame_rate=60/1
    avg_frame_rate=60/1
    time_base=1/15360
    start_pts=0
    start_time=0.000000
    duration_ts=193792
    duration=12.616667
    bit_rate=1903528
    max_bit_rate=N/A
    bits_per_raw_sample=8
    nb_frames=757
    nb_read_frames=N/A
    nb_read_packets=N/A
    DISPOSITION:default=1
    DISPOSITION:dub=0
    DISPOSITION:original=0
    DISPOSITION:comment=0
    DISPOSITION:lyrics=0
    DISPOSITION:karaoke=0
    DISPOSITION:forced=0
    DISPOSITION:hearing_impaired=0
    DISPOSITION:visual_impaired=0
    DISPOSITION:clean_effects=0
    DISPOSITION:attached_pic=0
    DISPOSITION:timed_thumbnails=0
    TAG:language=eng
    TAG:handler_name=VideoHandle
    [/STREAM]
    [STREAM]
    index=1
    codec_name=aac
    codec_long_name=AAC (Advanced Audio Coding)
    profile=LC
    codec_type=audio
    codec_time_base=1/48000
    codec_tag_string=mp4a
    codec_tag=0x6134706d
    sample_fmt=fltp
    sample_rate=48000
    channels=2
    channel_layout=stereo
    bits_per_sample=0
    id=N/A
    r_frame_rate=0/0
    avg_frame_rate=0/0
    time_base=1/48000
    start_pts=0
    start_time=0.000000
    duration_ts=606192
    duration=12.629000
    bit_rate=128049
    max_bit_rate=128049
    bits_per_raw_sample=N/A
    nb_frames=593
    nb_read_frames=N/A
    nb_read_packets=N/A
    DISPOSITION:default=1
    DISPOSITION:dub=0
    DISPOSITION:original=0
    DISPOSITION:comment=0
    DISPOSITION:lyrics=0
    DISPOSITION:karaoke=0
    DISPOSITION:forced=0
    DISPOSITION:hearing_impaired=0
    DISPOSITION:visual_impaired=0
    DISPOSITION:clean_effects=0
    DISPOSITION:attached_pic=0
    DISPOSITION:timed_thumbnails=0
    TAG:language=eng
    TAG:handler_name=SoundHandle
    [/STREAM]

    ffprobe -show_streams 26.mp4 :

    ffprobe version N-92246-gc2ac3b8e6a Copyright (c) 2007-2018 the FFmpeg developers
     built with gcc 8.2.1 (GCC) 20181017
     configuration: --enable-gpl --enable-version3 --enable-sdl2 --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. 19.101 / 56. 19.101
     libavcodec     58. 33.102 / 58. 33.102
     libavformat    58. 19.102 / 58. 19.102
     libavdevice    58.  4.106 / 58.  4.106
     libavfilter     7. 37.100 /  7. 37.100
     libswscale      5.  2.100 /  5.  2.100
     libswresample   3.  2.100 /  3.  2.100
     libpostproc    55.  2.100 / 55.  2.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '26.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf58.19.102
     Duration: 00:00:03.95, start: 0.000000, bitrate: 1814 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 2272x4608 [SAR 1:1 DAR 71:144], 1798 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 2 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
    [STREAM]
    index=0
    codec_name=h264
    codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
    profile=High
    codec_type=video
    codec_time_base=1/120
    codec_tag_string=avc1
    codec_tag=0x31637661
    width=2272
    height=4608
    coded_width=2272
    coded_height=4608
    has_b_frames=2
    sample_aspect_ratio=1:1
    display_aspect_ratio=71:144
    pix_fmt=yuv420p
    level=60
    color_range=unknown
    color_space=unknown
    color_transfer=unknown
    color_primaries=unknown
    chroma_location=left
    field_order=unknown
    timecode=N/A
    refs=1
    is_avc=true
    nal_length_size=4
    id=N/A
    r_frame_rate=60/1
    avg_frame_rate=60/1
    time_base=1/15360
    start_pts=0
    start_time=0.000000
    duration_ts=60672
    duration=3.950000
    bit_rate=1798815
    max_bit_rate=N/A
    bits_per_raw_sample=8
    nb_frames=237
    nb_read_frames=N/A
    nb_read_packets=N/A
    DISPOSITION:default=1
    DISPOSITION:dub=0
    DISPOSITION:original=0
    DISPOSITION:comment=0
    DISPOSITION:lyrics=0
    DISPOSITION:karaoke=0
    DISPOSITION:forced=0
    DISPOSITION:hearing_impaired=0
    DISPOSITION:visual_impaired=0
    DISPOSITION:clean_effects=0
    DISPOSITION:attached_pic=0
    DISPOSITION:timed_thumbnails=0
    TAG:language=und
    TAG:handler_name=VideoHandler
    [/STREAM]
    [STREAM]
    index=1
    codec_name=aac
    codec_long_name=AAC (Advanced Audio Coding)
    profile=LC
    codec_type=audio
    codec_time_base=1/44100
    codec_tag_string=mp4a
    codec_tag=0x6134706d
    sample_fmt=fltp
    sample_rate=44100
    channels=2
    channel_layout=stereo
    bits_per_sample=0
    id=N/A
    r_frame_rate=0/0
    avg_frame_rate=0/0
    time_base=1/44100
    start_pts=0
    start_time=0.000000
    duration_ts=132300
    duration=3.000000
    bit_rate=2124
    max_bit_rate=128000
    bits_per_raw_sample=N/A
    nb_frames=131
    nb_read_frames=N/A
    nb_read_packets=N/A
    DISPOSITION:default=1
    DISPOSITION:dub=0
    DISPOSITION:original=0
    DISPOSITION:comment=0
    DISPOSITION:lyrics=0
    DISPOSITION:karaoke=0
    DISPOSITION:forced=0
    DISPOSITION:hearing_impaired=0
    DISPOSITION:visual_impaired=0
    DISPOSITION:clean_effects=0
    DISPOSITION:attached_pic=0
    DISPOSITION:timed_thumbnails=0
    TAG:language=und
    TAG:handler_name=SoundHandler
    [/STREAM]