Recherche avancée

Médias (1)

Mot : - Tags -/bug

Autres articles (24)

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

Sur d’autres sites (5623)

  • Android YouTube Live v3 rtmp streaming via ffmpeg won't show preview

    14 décembre 2017, par Ariel Yust

    Hi everyone I’m breaking my head over this issue here,
    I’m developing an Android App for streaming content from the user’s device camera (back/front) to a live streaming on YouTube.

    Problem :
    YouTube Live shows "The health is good." in (Live Streaming->Events) but there’s nothing showing in the preview... in fact when I press play it tells me "An error has occurred, please try again later".

    Why is this happening ? what could be the problem ?

    What I’m doing :
    using google’s Oauth 2.0 and google api for login.
    YouTube V3 data api’s for creating a new broadcast and stream or use an opened stream - I’m using RTMP.

    I’m opening Camera Api1 and capturing the video into a SurfaceTexture, then I encode images and audio (MIC) using Android’s MediaCodec, save a 3+- seconds *.mp4 file locally and then once the muxer is done I stream the file with ffpmeg.

    String[] cmd = {
               "-i", filePath, //local file path (video is playable with vlc)
               "-strict", "experimental",
               "-acodec", "aac",
               "-ac", "1",
               "-ar", "44100",
               "-vcodec", "libx264",
               "-pix_fmt", "yuv420p",
               "-r", "30",
               "-g", "60",
               "-vb", "512k",
               "-profile:v", "main",
               "-preset", "medium",
               "-f", "flv",
               "-s", "1280x720",
               CreateBroadcast.rtmpUrl
           };

    ffmpeg.execute(cmd, responseHandler); //responseHandler notify me to send next file

    //how I set a new rtmpUrl, in CreateBroadcast.java
    rtmpUrl =
       returnedStream.getCdn().getIngestionInfo().getIngestionAddress() +
       File.separator +
       returnedStream.getCdn().getIngestionInfo().getStreamName();

    next file

    Using this ffmpeg library.

    ffmpeg process log :

    10:40:08.967 7..8/c.k.r D/Send: ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers, built with gcc 4.8 (GCC)
    10:40:08.968 7..8/c.k.r D/Send: configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
    10:40:08.969 7..8/c.k.r D/Send: onProgress ->   libavutil      55. 17.103 / 55. 17.103
    10:40:08.969 7..8/c.k.r D/Send: onProgress ->   libavcodec     57. 24.102 / 57. 24.102
    10:40:08.969 7..8/c.k.r D/Send: onProgress ->   libavformat    57. 25.100 / 57. 25.100
    10:40:08.970 7..8/c.k.r D/Send: onProgress ->   libavdevice    57.  0.101 / 57.  0.101
    10:40:08.970 7..8/c.k.r D/Send: onProgress ->   libavfilter     6. 31.100 /  6. 31.100
    10:40:08.971 7..8/c.k.r D/Send: onProgress ->   libswscale      4.  0.100 /  4.  0.100
    10:40:08.971 7..8/c.k.r D/Send: onProgress ->   libswresample   2.  0.101 /  2.  0.101
    10:40:08.971 7..8/c.k.r D/Send: onProgress ->   libpostproc    54.  0.100 / 54.  0.100
    10:40:09.202 7..8/c.k.r D/Send: onProgress -> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Movies/realPoll_0.mp4':
    10:40:09.203 7..8/c.k.r D/Send: onProgress ->   Metadata:
    10:40:09.203 7..8/c.k.r D/Send: onProgress ->     major_brand     : mp42
    10:40:09.204 7..8/c.k.r D/Send: onProgress ->     minor_version   : 0
    10:40:09.204 7..8/c.k.r D/Send: onProgress ->     compatible_brands: isommp42
    10:40:09.204 7..8/c.k.r D/Send: onProgress ->     creation_time   : 2017-08:40:08
    10:40:09.205 7..8/c.k.r D/Send: onProgress ->     com.android.version: 6.0.1
    10:40:09.205 7..8/c.k.r D/Send: onProgress ->   Duration: 00:00:02.79, start: 0.000000, bitrate: 4080 kb/s
    10:40:09.206 7..8/c.k.r D/Send: onProgress ->     Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x720, 4166 kb/s, SAR 1:1 DAR 16:9, 30.60 fps, 90k tbr, 90k tbn, 180k tbc (default)
    10:40:09.206 7..8/c.k.r D/Send: onProgress ->     Metadata:
    10:40:09.207 7..8/c.k.r D/Send: onProgress ->       creation_time   : 2017-08:40:08
    10:40:09.207 7..8/c.k.r D/Send: onProgress ->       handler_name    : VideoHandle
    10:40:09.208 7..8/c.k.r D/Send: onProgress ->     Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 59 kb/s (default)
    10:40:09.208 7..8/c.k.r D/Send: onProgress ->     Metadata:
    10:40:09.209 7..8/c.k.r D/Send: onProgress ->       creation_time   : 2017-08:40:08
    10:40:09.209 7..8/c.k.r D/Send: onProgress ->       handler_name    : SoundHandle
    10:40:10.312 7..8/c.k.r D/Send: onProgress -> [libx264 @ 0xb5b84800] using SAR=1/1
    10:40:10.324 7..8/c.k.r D/Send: onProgress -> [libx264 @ 0xb5b84800] using cpu capabilities: none!
    10:40:10.457 7..8/c.k.r D/Send: onProgress -> [libx264 @ 0xb5b84800] profile Main, level 3.1
    10:40:10.458 7..8/c.k.r D/Send: onProgress -> [libx264 @ 0xb5b84800] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 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=0 weightp=2 keyint=60 keyint_min=6 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=512 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    10:40:10.494 7..8/c.k.r D/Send: onProgress -> Output #0, flv, to 'rtmp://a.rtmp.youtube.com/live2/b2mb-vjew-2205-8w39':
    10:40:10.495 7..8/c.k.r D/Send: onProgress ->   Metadata:
    10:40:10.496 7..8/c.k.r D/Send: onProgress ->     major_brand     : mp42
    10:40:10.499 7..8/c.k.r D/Send: onProgress ->     minor_version   : 0
    10:40:10.500 7..8/c.k.r D/Send: onProgress ->     compatible_brands: isommp42
    10:40:10.502 7..8/c.k.r D/Send: onProgress ->     com.android.version: 6.0.1
    10:40:10.504 7..8/c.k.r D/Send: onProgress ->     encoder         : Lavf57.25.100
    10:40:10.505 7..8/c.k.r D/Send: onProgress ->     Stream #0:0(eng): Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 512 kb/s, 30 fps, 1k tbn, 30 tbc (default)
    10:40:10.507 7..8/c.k.r D/Send: onProgress ->     Metadata:
    10:40:10.509 7..8/c.k.r D/Send: onProgress ->       creation_time   : 2017-08:40:08
    10:40:10.510 7..8/c.k.r D/Send: onProgress ->       handler_name    : VideoHandle
    10:40:10.511 7..8/c.k.r D/Send: onProgress ->       encoder         : Lavc57.24.102 libx264
    10:40:10.512 7..8/c.k.r D/Send: onProgress ->     Side data:
    10:40:10.512 7..8/c.k.r D/Send: onProgress ->       unknown side data type 10 (24 bytes)
    10:40:10.514 7..8/c.k.r D/Send: onProgress ->     Stream #0:1(eng): Audio: aac (LC) ([10][0][0][0] / 0x000A), 44100 Hz, mono, fltp, 69 kb/s (default)
    10:40:10.521 7..8/c.k.r D/Send: onProgress ->     Metadata:
    10:40:10.522 7..8/c.k.r D/Send: onProgress ->       creation_time   : 2017-08:40:08
    10:40:10.522 7..8/c.k.r D/Send: onProgress ->       handler_name    : SoundHandle
    10:40:10.522 7..8/c.k.r D/Send: onProgress ->       encoder         : Lavc57.24.102 aac
    10:40:10.523 7..8/c.k.r D/Send: onProgress -> Stream mapping:
    10:40:10.523 7..8/c.k.r D/Send: onProgress ->   Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
    10:40:10.524 7..8/c.k.r D/Send: onProgress ->   Stream #0:1 -> #0:1 (aac (native) -> aac (native))
    10:40:10.524 7..8/c.k.r D/Send: onProgress -> Press [q] to stop, [?] for help
    10:40:11.017 7..8/c.k.r D/Send: onProgress -> frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.92 bitrate=   4.3kbits/s speed=1.82x    
    10:40:11.300 7..8/c.k.r D/Send: onProgress -> Past duration 0.912331 too large
    10:40:11.342 7..8/c.k.r D/Send: onProgress -> Past duration 0.874321 too large
    10:40:11.376 7..8/c.k.r D/Send: onProgress -> Past duration 0.903664 too large
    10:40:11.411 7..8/c.k.r D/Send: onProgress -> Past duration 0.884666 too large
    10:40:11.545 7..8/c.k.r D/Send: onProgress -> frame=   12 fps= 12 q=0.0 size=       0kB time=00:00:01.03 bitrate=   3.9kbits/s dup=0 drop=2 speed=   1x    
    10:40:12.105 7..8/c.k.r D/Send: onProgress -> frame=   25 fps= 16 q=0.0 size=       0kB time=00:00:01.03 bitrate=   3.9kbits/s dup=0 drop=2 speed=0.667x    
                                                                          [ 10:40:12.379   191:  191 E/         ]
                                                                          invalid crash request of size 4 (from pid=7244 uid=0)
    10:40:12.598 7..8/c.k.r D/Send: onProgress -> frame=   32 fps= 15 q=0.0 size=       0kB time=00:00:02.02 bitrate=   2.0kbits/s dup=0 drop=2 speed=0.98x    
    10:40:12.598 7..8/c.k.r D/Send: onProgress -> Past duration 0.792656 too large
    10:40:12.675 7..8/c.k.r D/Send: onProgress -> Past duration 0.710991 too large
    10:40:12.708 7..8/c.k.r D/Send: onProgress -> Past duration 0.688332 too large
    10:40:12.725 7..8/c.k.r D/Send: onProgress -> Past duration 0.710655 too large
    10:40:12.760 7..8/c.k.r D/Send: onProgress -> Past duration 0.716331 too large
    10:40:12.775 7..8/c.k.r D/Send: onProgress -> Past duration 0.713661 too large
    10:40:12.791 7..8/c.k.r D/Send: onProgress -> Past duration 0.688332 too large
    10:40:12.825 7..8/c.k.r D/Send: onProgress -> Past duration 0.633659 too large
    10:40:12.857 7..8/c.k.r D/Send: onProgress -> Past duration 0.661324 too large
    10:40:12.876 7..8/c.k.r D/Send: onProgress -> Past duration 0.670998 too large
    10:40:12.942 7..8/c.k.r D/Send: onProgress -> Past duration 0.640327 too large
    10:40:17.761 7..8/c.k.r D/Send: onProgress -> frame=   47 fps=6.7 q=0.0 size=       0kB time=00:00:02.02 bitrate=   2.0kbits/s dup=0 drop=2 speed=0.288x    
    10:40:17.929 7..8/c.k.r D/Send: onProgress -> Past duration 0.605324 too large
    10:40:17.997 7..8/c.k.r D/Send: onProgress -> Past duration 0.614998 too large
    10:40:18.520 7..8/c.k.r D/Send: onProgress -> frame=   51 fps=6.6 q=42.0 size=       4kB time=00:00:02.02 bitrate=  17.0kbits/s dup=0 drop=2 speed=0.263x    
    10:40:18.520 7..8/c.k.r D/Send: onProgress -> Past duration 0.605995 too large
    10:40:19.607 7..8/c.k.r D/Send: onProgress -> Past duration 0.608986 too large
    10:40:19.843 7..8/c.k.r D/Send: onProgress -> frame=   53 fps=5.8 q=42.0 size=       9kB time=00:00:02.02 bitrate=  34.8kbits/s dup=0 drop=2 speed=0.223x    
    10:40:20.365 7..8/c.k.r D/Send: onProgress -> Past duration 0.614326 too large
    10:40:20.710 7..8/c.k.r D/Send: onProgress -> frame=   56 fps=5.7 q=41.0 size=      16kB time=00:00:02.02 bitrate=  66.2kbits/s dup=0 drop=2 speed=0.206x    
    10:40:21.348 7..8/c.k.r D/Send: onProgress -> frame=   58 fps=5.5 q=41.0 size=      20kB time=00:00:02.02 bitrate=  82.1kbits/s dup=0 drop=2 speed=0.193x    
    10:40:22.419 7..8/c.k.r D/Send: onProgress -> frame=   61 fps=5.2 q=41.0 size=      27kB time=00:00:02.02 bitrate= 108.3kbits/s dup=0 drop=2 speed=0.173x    
    10:40:23.232 7..8/c.k.r D/Send: onProgress -> frame=   64 fps=5.1 q=41.0 size=      33kB time=00:00:02.02 bitrate= 133.1kbits/s dup=0 drop=2 speed=0.161x    
    10:40:24.659 7..8/c.k.r D/Send: onProgress -> frame=   67 fps=4.8 q=40.0 size=      38kB time=00:00:02.02 bitrate= 154.5kbits/s dup=0 drop=2 speed=0.145x    
    10:40:25.591 7..8/c.k.r D/Send: onProgress -> frame=   69 fps=4.7 q=40.0 size=      42kB time=00:00:02.02 bitrate= 169.5kbits/s dup=0 drop=2 speed=0.138x    
    10:40:26.137 7..8/c.k.r D/Send: onProgress -> frame=   71 fps=4.6 q=39.0 size=      45kB time=00:00:02.02 bitrate= 183.6kbits/s dup=0 drop=2 speed=0.132x    
    10:40:26.913 7..8/c.k.r D/Send: onProgress -> frame=   73 fps=4.5 q=39.0 size=      46kB time=00:00:02.02 bitrate= 187.6kbits/s dup=0 drop=2 speed=0.125x    
    10:40:27.234 7..8/c.k.r D/Send: onProgress -> frame=   76 fps=4.5 q=38.0 size=      49kB time=00:00:02.48 bitrate= 162.7kbits/s dup=0 drop=2 speed=0.149x    
    10:40:27.295 7..8/c.k.r D/Send: onProgress -> Past duration 0.686333 too large
    10:40:27.801 7..8/c.k.r D/Send: onProgress -> Past duration 0.840324 too large
    10:40:28.269 7..8/c.k.r D/Send: onProgress -> frame=   78 fps=4.5 q=37.0 size=      53kB time=00:00:02.54 bitrate= 171.5kbits/s dup=0 drop=2 speed=0.147x    
    10:40:28.269 7..8/c.k.r D/Send: onProgress -> Past duration 0.739662 too large
    10:40:28.336 7..8/c.k.r D/Send: onProgress -> Past duration 0.671333 too large
    10:40:28.373 7..8/c.k.r D/Send: onProgress -> frame=   80 fps=4.5 q=37.0 size=      59kB time=00:00:02.54 bitrate= 188.7kbits/s dup=0 drop=2 speed=0.143x    
    10:40:41.320 7..8/c.k.r D/Send: onProgress -> [flv @ 0xb5ba9600] Failed to update header with correct duration.
    10:40:41.321 7..8/c.k.r D/Send: onProgress -> [flv @ 0xb5ba9600] Failed to update header with correct filesize.
    10:40:41.321 7..8/c.k.r D/Send: onProgress -> frame=   80 fps=2.6 q=-1.0 Lsize=     155kB time=00:00:02.70 bitrate= 468.9kbits/s dup=0 drop=2 speed=0.0877x    
    10:40:41.322 7..8/c.k.r D/Send: onProgress -> video:128kB audio:23kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.617489%
    10:40:41.332 7..8/c.k.r D/Send: onProgress -> [libx264 @ 0xb5b84800] frame I:2     Avg QP:28.63  size:  3516
    10:40:41.333 7..8/c.k.r D/Send: onProgress -> [libx264 @ 0xb5b84800] frame P:62    Avg QP:28.45  size:  1878
    10:40:41.333 7..8/c.k.r D/Send: onProgress -> [libx264 @ 0xb5b84800] frame B:16    Avg QP:29.68  size:   400
    10:40:41.334 7..8/c.k.r D/Send: onProgress -> [libx264 @ 0xb5b84800] consecutive B-frames: 71.2%  5.0%  3.8% 20.0%
    10:40:41.334 7..8/c.k.r D/Send: onProgress -> [libx264 @ 0xb5b84800] mb I  I16..4: 98.8%  0.0%  1.2%
    10:40:41.334 7..8/c.k.r D/Send: onProgress -> [libx264 @ 0xb5b84800] mb P  I16..4: 17.8%  0.0%  0.1%  P16..4: 17.0%  0.2%  0.7%  0.0%  0.0%    skip:64.2%
    10:40:41.335 7..8/c.k.r D/Send: onProgress -> [libx264 @ 0xb5b84800] mb B  I16..4:  0.1%  0.0%  0.0%  B16..8: 11.9%  0.0%  0.0%  direct: 1.0%  skip:87.0%  L0:16.0% L1:84.0% BI: 0.0%
    10:40:41.335 7..8/c.k.r D/Send: onProgress -> [libx264 @ 0xb5b84800] final ratefactor: 30.20
    10:40:41.336 7..8/c.k.r D/Send: onProgress -> [libx264 @ 0xb5b84800] coded y,uvDC,uvAC intra: 1.4% 20.4% 0.0% inter: 0.4% 14.0% 0.0%
    10:40:41.338 7..8/c.k.r D/Send: onProgress -> [libx264 @ 0xb5b84800] i16 v,h,dc,p: 66% 22%  7%  4%
    10:40:41.339 7..8/c.k.r D/Send: onProgress -> [libx264 @ 0xb5b84800] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu:  7% 19% 53%  4%  4%  3%  5%  2%  2%
    10:40:41.339 7..8/c.k.r D/Send: onProgress -> [libx264 @ 0xb5b84800] i8c dc,h,v,p: 71% 16% 12%  0%
    10:40:41.340 7..8/c.k.r D/Send: onProgress -> [libx264 @ 0xb5b84800] Weighted P-Frames: Y:6.5% UV:6.5%
    10:40:41.340 7..8/c.k.r D/Send: onProgress -> [libx264 @ 0xb5b84800] ref P L0: 85.6%  4.5%  7.7%  2.2%  0.0%
    10:40:41.341 7..8/c.k.r D/Send: onProgress -> [libx264 @ 0xb5b84800] ref B L0: 99.3%  0.7%
    10:40:41.341 7..8/c.k.r D/Send: onProgress -> [libx264 @ 0xb5b84800] ref B L1: 97.0%  3.0%
    10:40:41.342 7..8/c.k.r D/Send: onProgress -> [libx264 @ 0xb5b84800] kb/s:384.88
    10:40:41.421 7..8/c.k.r D/Send: onProgress -> [aac @ 0xb5b85000] Qavg: 1561.786
    10:40:41.423 7..8/c.k.r D/Send: onSuccess -> configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
    10:40:41.423 7..8/c.k.r D/Send:   libavutil      55. 17.103 / 55. 17.103
    10:40:41.423 7..8/c.k.r D/Send:   libavcodec     57. 24.102 / 57. 24.102
    10:40:41.423 7..8/c.k.r D/Send:   libavformat    57. 25.100 / 57. 25.100
    10:40:41.423 7..8/c.k.r D/Send:   libavdevice    57.  0.101 / 57.  0.101
    10:40:41.424 7..8/c.k.r D/Send:   libavfilter     6. 31.100 /  6. 31.100
    10:40:41.424 7..8/c.k.r D/Send:   libswscale      4.  0.100 /  4.  0.100
    10:40:41.424 7..8/c.k.r D/Send:   libswresample   2.  0.101 /  2.  0.101
    10:40:41.424 7..8/c.k.r D/Send:   libpostproc    54.  0.100 / 54.  0.100
    10:40:41.424 7..8/c.k.r D/Send: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Movies/realPoll_0.mp4':
    10:40:41.424 7..8/c.k.r D/Send:   Metadata:
    10:40:41.424 7..8/c.k.r D/Send:     major_brand     : mp42
    10:40:41.424 7..8/c.k.r D/Send:     minor_version   : 0
    10:40:41.424 7..8/c.k.r D/Send:     compatible_brands: isommp42
    10:40:41.424 7..8/c.k.r D/Send:     creation_time   : 2017-08:40:08
    10:40:41.424 7..8/c.k.r D/Send:     com.android.version: 6.0.1
    10:40:41.424 7..8/c.k.r D/Send:   Duration: 00:00:02.79, start: 0.000000, bitrate: 4080 kb/s
    10:40:41.424 7..8/c.k.r D/Send:     Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x720, 4166 kb/s, SAR 1:1 DAR 16:9, 30.60 fps, 90k tbr, 90k tbn, 180k tbc (default)
    10:40:41.424 7..8/c.k.r D/Send:     Metadata:
    10:40:41.424 7..8/c.k.r D/Send:       creation_time   : 2017-08:40:08
    10:40:41.424 7..8/c.k.r D/Send:       handler_name    : VideoHandle
    10:40:41.424 7..8/c.k.r D/Send:     Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 59 kb/s (default)
    10:40:41.424 7..8/c.k.r D/Send:     Metadata:
    10:40:41.424 7..8/c.k.r D/Send:       creation_time   : 2017-08:40:08
    10:40:41.424 7..8/c.k.r D/Send:       handler_name    : SoundHandle
    10:40:41.425 7..8/c.k.r D/Send: [libx264 @ 0xb5b84800] using SAR=1/1
    10:40:41.425 7..8/c.k.r D/Send: [libx264 @ 0xb5b84800] using cpu capabilities: none!
    10:40:41.425 7..8/c.k.r D/Send: [libx264 @ 0xb5b84800] profile Main, level 3.1
    10:40:41.425 7..8/c.k.r D/Send: [libx264 @ 0xb5b84800] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 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=0 weightp=2 keyint=60 keyint_min=6 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=512 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    10:40:41.425 7..8/c.k.r D/Send: Output #0, flv, to 'rtmp://a.rtmp.youtube.com/live2/b2mb-vjew-2205-8w39':
    10:40:41.425 7..8/c.k.r D/Send:   Metadata:
    10:40:41.425 7..8/c.k.r D/Send:     major_brand     : mp42
    10:40:41.425 7..8/c.k.r D/Send:     minor_version   : 0
    10:40:41.425 7..8/c.k.r D/Send:     compatible_brands: isommp42
    10:40:41.425 7..8/c.k.r D/Send:     com.android.version: 6.0.1
    10:40:41.425 7..8/c.k.r D/Send:     encoder         : Lavf57.25.100
    10:40:41.425 7..8/c.k.r D/Send:     Stream #0:0(eng): Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 512 kb/s, 30 fps, 1k tbn, 30 tbc (default)
    10:40:41.425 7..8/c.k.r D/Send:     Metadata:
    10:40:41.425 7..8/c.k.r D/Send:       creation_time   : 2017-08:40:08
    10:40:41.425 7..8/c.k.r D/Send:       handler_name    : VideoHandle
    10:40:41.425 7..8/c.k.r D/Send:       encoder         : Lavc57.24.102 libx264
    10:40:41.425 7..8/c.k.r D/Send:     Side data:
    10:40:41.425 7..8/c.k.r D/Send:       unknown side data type 10 (24 bytes)
    10:40:41.425 7..8/c.k.r D/Send:     Stream #0:1(eng): Audio: aac (LC) ([10][0][0][0] / 0x000A), 44100 Hz, mono, fltp, 69 kb/s (default)
    10:40:41.426 7..8/c.k.r D/Send:     Metadata:
    10:40:41.426 7..8/c.k.r D/Send:       creation_time   : 2017-08:40:08
    10:40:41.426 7..8/c.k.r D/Send:       handler_name    : SoundHandle
    10:40:41.426 7..8/c.k.r D/Send:       encoder         : Lavc57.24.102 aac
    10:40:41.426 7..8/c.k.r D/Send: Stream mapping:
    10:40:41.426 7..8/c.k.r D/Send:   Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
    10:40:41.427 7..8/c.k.r D/Send:   Stream #0:1 -> #0:1 (aac (native) -> aac (native))
    10:40:41.427 7..8/c.k.r D/Send: Press [q] to stop, [?] for help
    10:40:41.427 7..8/c.k.r D/Send: frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.92 bitrate=   4.3kbits/s speed=1.82x    
    10:40:41.427 7..8/c.k.r D/Send: Past duration 0.912331 too large
    10:40:41.427 7..8/c.k.r D/Send: Past duration 0.874321 too large
    10:40:41.427 7..8/c.k.r D/Send: Past duration 0.903664 too large
    10:40:41.427 7..8/c.k.r D/Send: Past duration 0.884666 too large
    10:40:41.427 7..8/c.k.r D/Send: frame=   12 fps= 12 q=0.0 size=       0kB time=00:00:01.03 bitrate=   3.9kbits/s dup=0 drop=2 speed=   1x    
    10:40:41.427 7..8/c.k.r D/Send: frame=   25 fps= 16 q=0.0 size=       0kB time=00:00:01.03 bitrate=   3.9kbits/s dup=0 drop=2 speed=0.667x    
    10:40:41.427 7..8/c.k.r D/Send: frame=   32 fps= 15 q=0.0 size=       0kB time=00:00:02.02 bitrate=   2.0kbits/s dup=0 drop=2 speed=0.98x    
    10:40:41.427 7..8/c.k.r D/Send: Past duration 0.792656 too large
    10:40:41.427 7..8/c.k.r D/Send: Past duration 0.710991 too large
    10:40:41.427 7..8/c.k.r D/Send: Past duration 0.688332 too large
    10:40:41.427 7..8/c.k.r D/Send: Past duration 0.710655 too large
    10:40:41.427 7..8/c.k.r D/Send: Past duration 0.716331 too large
    10:40:41.427 7..8/c.k.r D/Send: Past duration 0.713661 too large
    10:40:41.427 7..8/c.k.r D/Send: Past duration 0.688332 too large
    10:40:41.427 7..8/c.k.r D/Send: Past duration 0.633659 too large
    10:40:41.427 7..8/c.k.r D/Send: Past duration 0.661324 too large
    10:40:41.427 7..8/c.k.r D/Send: Past duration 0.670998 too large
    10:40:41.427 7..8/c.k.r D/Send: Past duration 0.640327 too large
    10:40:41.427 7..8/c.k.r D/Send: frame=   47 fps=6.7 q=0.0 size=       0kB time=00:00:02.02 bitrate=   2.0kbits/s dup=0 drop=2 speed=0.288x    
    10:40:41.427 7..8/c.k.r D/Send: Past duration 0.605324 too large
    10:40:41.428 7..8/c.k.r D/Send: Past duration 0.614998 too large
    10:40:41.428 7..8/c.k.r D/Send: frame=   51 fps=6.6 q=42.0 size=       4kB time=00:00:02.02 bitrate=  17.0kbits/s dup=0 drop=2 speed=0.263x    
    10:40:41.428 7..8/c.k.r D/Send: Past duration 0.605995 too large
    10:40:41.428 7..8/c.k.r D/Send: Past duration 0.608986 too large
    10:40:41.428 7..8/c.k.r D/Send: frame=   53 fps=5.8 q=42.0 size=       9kB time=00:00:02.02 bitrate=  34.8kbits/s dup=0 drop=2 speed=0.223x    
    10:40:41.428 7..8/c.k.r D/Send: Past duration 0.614326 too large
    10:40:41.428 7..8/c.k.r D/Send: frame=   56 fps=5.7 q=41.0 size=      16kB time=00:00:02.02 bitrate=  66.2kbits/s dup=0 drop=2 speed=0.206x    
    10:40:41.428 7..8/c.k.r D/Send: frame=   58 fps=5.5 q=41.0 size=      20kB time=00:00:02.02 bitrate=  82.1kbits/s dup=0 drop=2 speed=0.193x    
    10:40:41.428 7..8/c.k.r D/Send: frame=   61 fps=5.2 q=41.0 size=      27kB time=00:00:02.02 bitrate= 108.3kbits/s dup=0 drop=2 speed=0.173x    
    10:40:41.428 7..8/c.k.r D/Send: frame=   64 fps=5.1 q=41.0 size=      33kB time=00:00:02.02 bitrate= 133.1kbits/s dup=0 drop=2 speed=0.161x    
    10:40:41.428 7..8/c.k.r D/Send: frame=   67 fps=4.8 q=40.0 size=      38kB time=00:00:02.02 bitrate= 154.5kbits/s dup=0 drop=2 speed=0.145x    
    10:40:41.428 7..8/c.k.r D/Send: frame=   69 fps=4.7 q=40.0 size=      42kB time=00:00:02.02 bitrate= 169.5kbits/s dup=0 drop=2 speed=0.138x    
    10:40:41.428 7..8/c.k.r D/Send: frame=   71 fps=4.6 q=39.0 size=      45kB time=00:00:02.02 bitrate= 183.6kbits/s dup=0 drop=2 speed=0.132x    
    10:40:41.428 7..8/c.k.r D/Send: frame=   73 fps=4.5 q=39.0 size=      46kB time=00:00:02.02 bitrate= 187.6kbits/s dup=0 drop=2 speed=0.125x    
    10:40:41.428 7..8/c.k.r D/Send: frame=   76 fps=4.5 q=38.0 size=      49kB time=00:00:02.48 bitrate= 162.7kbits/s dup=0 drop=2 speed=0.149x    
    10:40:41.428 7..8/c.k.r D/Send: Past duration 0.686333 too large
    10:40:41.428 7..8/c.k.r D/Send: Past duration 0.840324 too large
    10:40:41.428 7..8/c.k.r D/Send: frame=   78 fps=4.5 q=37.0 size=      53kB time=00:00:02.54 bitrate= 171.5kbits/s dup=0 drop=2 speed=0.147x    
    10:40:41.428 7..8/c.k.r D/Send: Past duration 0.739662 too large
    10:40:41.429 7..8/c.k.r D/Send: Past duration 0.671333 too large
    10:40:41.429 7..8/c.k.r D/Send: frame=   80 fps=4.5 q=37.0 size=      59kB time=00:00:02.54 bitrate= 188.7kbits/s dup=0 drop=2 speed=0.143x    
    10:40:41.429 7..8/c.k.r D/Send: [flv @ 0xb5ba9600] Failed to update header with correct duration.
    10:40:41.429 7..8/c.k.r D/Send: [flv @ 0xb5ba9600] Failed to update header with correct filesize.
    10:40:41.429 7..8/c.k.r D/Send: frame=   80 fps=2.6 q=-1.0 Lsize=     155kB time=00:00:02.70 bitrate= 468.9kbits/s dup=0 drop=2 speed=0.0877x    
    10:40:41.429 7..8/c.k.r D/Send: video:128kB audio:23kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.617489%
    10:40:41.429 7..8/c.k.r D/Send: [libx264 @ 0xb5b84800] frame I:2     Avg QP:28.63  size:  3516
    10:40:41.429 7..8/c.k.r D/Send: [libx264 @ 0xb5b84800] frame P:62    Avg QP:28.45  size:  1878
    10:40:41.429 7..8/c.k.r D/Send: [libx264 @ 0xb5b84800] frame B:16    Avg QP:29.68  size:   400
    10:40:41.429 7..8/c.k.r D/Send: [libx264 @ 0xb5b84800] consecutive B-frames: 71.2%  5.0%  3.8% 20.0%
    10:40:41.429 7..8/c.k.r D/Send: [libx264 @ 0xb5b84800] mb I  I16..4: 98.8%  0.0%  1.2%
    10:40:41.429 7..8/c.k.r D/Send: [libx264 @ 0xb5b84800] mb P  I16..4: 17.8%  0.0%  0.1%  P16..4: 17.0%  0.2%  0.7%  0.0%  0.0%    skip:64.2%
    10:40:41.429 7..8/c.k.r D/Send: [libx264 @ 0xb5b84800] mb B  I16..4:  0.1%  0.0%  0.0%  B16..8: 11.9%  0.0%  0.0%  direct: 1.0%  skip:87.0%  L0:16.0% L1:84.0% BI: 0.0%
    10:40:41.429 7..8/c.k.r D/Send: [libx264 @ 0xb5b84800] final ratefactor: 30.20
    10:40:41.429 7..8/c.k.r D/Send: [libx264 @ 0xb5b84800] coded y,uvDC,uvAC intra: 1.4% 20.4% 0.0% inter: 0.4% 14.0% 0.0%
    10:40:41.429 7..8/c.k.r D/Send: [libx264 @ 0xb5b84800] i16 v,h,dc,p: 66% 22%  7%  4%
    10:40:41.429 7..8/c.k.r D/Send: [libx264 @ 0xb5b84800] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu:  7% 19% 53%  4%  4%  3%  5%  2%  2%
    10:40:41.429 7..8/c.k.r D/Send: [libx264 @ 0xb5b84800] i8c dc,h,v,p: 71% 16% 12%  0%
    10:40:41.430 7..8/c.k.r D/Send: [libx264 @ 0xb5b84800] Weighted P-Frames: Y:6.5% UV:6.5%
    10:40:41.430 7..8/c.k.r D/Send: [libx264 @ 0xb5b84800] ref P L0: 85.6%  4.5%  7.7%  2.2%  0.0%
    10:40:41.430 7..8/c.k.r D/Send: [libx264 @ 0xb5b84800] ref B L0: 99.3%  0.7%
    10:40:41.430 7..8/c.k.r D/Send: [libx264 @ 0xb5b84800] ref B L1: 97.0%  3.0%
    10:40:41.430 7..8/c.k.r D/Send: [libx264 @ 0xb5b84800] kb/s:384.88
    10:40:41.430 7..8/c.k.r D/Send: [aac @ 0xb5b85000] Qavg: 1561.786

    Thanks for your time and insights !

  • Hikvision NVR video conversion ffmpeg

    6 août 2024, par astralmaster

    I have a Hikvision NVR that stores security camera footage that I need to display on a website. I know that Hikvision uses proprietary H.264 codec that makes it impossible to play (coherently) in popular video players, like VLC, unless you install that codec everywhere you play it.

    



    My plan was to transcode the video using ffmpeg to regular H.264 codec and AAC for audio but the produced file has the same issues as the original - no audio when playing and very disruptive video. 
So the question is, does ffmpeg support encoding from Hikvision video/audio codecs ? Or perhaps should try to convert to different web-capable codecs using ffmpeg ?
My ffmpeg command looks like this :

    



    ffmpeg -i C:\1.mp4  -c:v libx264 -preset fast -crf 30 -b:v 200k -c:a aac -strict experimental -movflags faststart -threads 0 C:\2.mp4


    



    EDIT : What's interesting is that ffplay.exe opens and plays the original video files with no problem whatsoever, even on a computer where Hikvision codecs are not isntalled, therefore I figured conversion should be possible as well ?

    



    Mediainfo output of the video file in question :

    



    General
CompleteName                     : C:\DownLoad\1.mp4
Format                           : MPEG-PS
FileSize/String                  : 8.60 MiB
Duration/String                  : 2 h 7 min
OverallBitRate/String            : 9 395 b/s
FileExtension_Invalid            : mpeg mpg m2p vob pss evo

Video
ID/String                        : 224 (0xE0)
Format                           : AVC
Format/Info                      : Advanced Video Codec
Format_Profile                   : Baseline@L4
Format_Settings                  : 1 Ref Frames
Format_Settings_CABAC/String     : No
Format_Settings_RefFrames/String : 1 frame
Format_Settings_GOP              : M=1, N=30
Duration/String                  : 2 min 0 s
Width/String                     : 1 920 pixels
Height/String                    : 1 080 pixels
DisplayAspectRatio/String        : 16:9
FrameRate_Mode/String            : Variable
ColorSpace                       : YUV
ChromaSubsampling/String         : 4:2:0
BitDepth/String                  : 8 bits
ScanType/String                  : Progressive

Audio
ID/String                        : 192 (0xC0)
Format                           : MPEG Audio
Duration/String                  : 2 h 7 min
Compression_Mode/String          : Lossy
Video_Delay/String               : -33 min 40 s


    



    Output of ffmpeg :

    



    C:\ffmpeg\bin>ffmpeg -i C:\DownLoad\1.mp4  -c:v libx264 -preset fast -crf 30 -b:v 75k -c:a aac -strict experimental -movflags faststart -threads 0 C:\DownLoad\2.mp4
ffmpeg version N-86537-gae6f6d4 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7.1.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
  libavutil      55. 66.100 / 55. 66.100
  libavcodec     57. 99.100 / 57. 99.100
  libavformat    57. 73.100 / 57. 73.100
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 94.100 /  6. 94.100
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
Input #0, mpeg, from 'C:\DownLoad\1.mp4':
  Duration: 02:07:57.93, start: 789.820800, bitrate: 9 kb/s
    Stream #0:0[0x1e0]: Video: h264 (Baseline), yuv420p(progressive), 1920x1080, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x1c0]: Audio: pcm_mulaw, 8000 Hz, mono, s16, 64 kb/s
File 'C:\DownLoad\2.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (pcm_mulaw (native) -> aac (native))
Press [q] to stop, [?] for help
[aac @ 0000000002cd0280] Too many bits 8832.000000 > 6144 per frame requested, clamping to max
[libx264 @ 0000000002514c80] using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX XOP FMA4
[libx264 @ 0000000002514c80] profile High, level 4.0
[libx264 @ 0000000002514c80] 264 - core 150 r2833 df79067 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=6 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=0 weightp=1 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=30 rc=crf mbtree=1 crf=30.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'C:\DownLoad\2.mp4':
  Metadata:
    encoder         : Lavf57.73.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080, q=-1--1, 75 kb/s, 25 fps, 12800 tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.99.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/75000 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 8000 Hz, mono, fltp, 48 kb/s
    Metadata:
      encoder         : Lavc57.99.100 aac
[mp4 @ 00000000010e9e00] Starting second pass: moving the moov atom to the beginning of the file speed= 116x
frame= 3269 fps= 66 q=-1.0 Lsize=   11086kB time=01:34:24.38 bitrate=  16.0kbits/s dup=269 drop=0 speed= 115x
video:10429kB audio:592kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.594114%
[libx264 @ 0000000002514c80] frame I:14    Avg QP:21.86  size: 59795
[libx264 @ 0000000002514c80] frame P:833   Avg QP:24.81  size:  8993
[libx264 @ 0000000002514c80] frame B:2422  Avg QP:28.70  size:   970
[libx264 @ 0000000002514c80] consecutive B-frames:  1.0%  0.2%  1.4% 97.4%
[libx264 @ 0000000002514c80] mb I  I16..4: 18.9% 66.3% 14.8%
[libx264 @ 0000000002514c80] mb P  I16..4:  4.0%  7.7%  0.4%  P16..4: 16.2%  2.0%  0.6%  0.0%  0.0%    skip:69.1%
[libx264 @ 0000000002514c80] mb B  I16..4:  0.6%  0.2%  0.0%  B16..8:  5.5%  0.1%  0.0%  direct: 0.7%  skip:92.9%  L0:44.0% L1:55.0% BI: 1.0%
[libx264 @ 0000000002514c80] 8x8 transform intra:59.0% inter:83.3%
[libx264 @ 0000000002514c80] coded y,uvDC,uvAC intra: 25.3% 36.1% 7.7% inter: 1.0% 2.3% 0.1%
[libx264 @ 0000000002514c80] i16 v,h,dc,p: 23% 24% 43% 10%
[libx264 @ 0000000002514c80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 37% 26% 23%  2%  2%  3%  2%  3%  3%
[libx264 @ 0000000002514c80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 23% 12%  4%  4%  5%  4%  4%  2%
[libx264 @ 0000000002514c80] i8c dc,h,v,p: 81%  7%  9%  3%
[libx264 @ 0000000002514c80] Weighted P-Frames: Y:1.0% UV:0.0%
[libx264 @ 0000000002514c80] ref P L0: 73.6% 26.4%
[libx264 @ 0000000002514c80] ref B L0: 80.9% 19.1%
[libx264 @ 0000000002514c80] ref B L1: 90.0% 10.0%
[libx264 @ 0000000002514c80] kb/s:653.30
[aac @ 0000000002cd0280] Qavg: 64512.656

C:\ffmpeg\bin>


    



    Download link to sample :

    



    https://www.dropbox.com/s/9ccptsuiqk2ntsv/1.zip?dl=0

    



    This sample is exactly 2 minutes long, but VLC will tell you otherwise.

    


  • Fixing A/V sync issues with RTP/RTCP sent from mediasoup

    10 décembre 2017, par artushin

    A little background : I’m attempting to record a webrtc call being made through the mediasoup v2 SFU. I’m using mediasoup’s room.createRtpStreamer() method to generate a stream which mirrors RTP/RTCP to ffmpeg. Two streamers are created for audio and video within 30ms of each other and begin broadcasting. FFmpeg then spins up and starts accepting. Pretty sure RTCP is working since ffmpeg is always starting with a keyframe despite being started after the streamer begins broadcasting.

    The problem is that I encounter audio/video desynchronization with seemingly random offsets. My current theory is that this offset is based on how old the last keyframe is that RTCP requests to start the stream. See below for ffmpeg configuration and output but my question is : what ffmpeg arguments can I use to adjust the video frame timestamps to match the audio frame timestamps or vice versa ? I’ve messed around with -map 0:0,0:1 -map 0:1,0:1 but it doesn’t seem to do what I’m looking for.

    ffmpeg flags :

    '-y',
    '-loglevel',
    'debug',
    '-dump',
    '-protocol_whitelist',
    'file,crypto,udp,rtp,data',
    '-analyzeduration',
    '20M',
    '-probesize',
    '20M',
    '-i',
    `data:text/plain;base64,${sdp.toString('base64')}`,
    '-fflags',
    '+genpts',
    '-vcodec',
    'copy',
    '-acodec',
    'aac',
    '-bsf:v',
    'h264_mp4toannexb',
    '-start_number',
    '0',
    '-hls_list_size',
    '2147480000',
    '-hls_wrap',
    '0',
    '-hls_time',
    '10',

    SDP used for input (template) :

    v=0
    o=- 0 0 IN IP4 <%=ip %>
    s=title
    c=IN IP4 <%=ip %>
    m=audio <%=audioPort %> RTP/AVPF <%=audioPayload %>
    a=sendrecv
    a=rtcp-mux
    a=rtpmap:<%=audioPayload %> opus/48000/2
    a=fmtp:<%=audioPayload %> minptime=10; useinbandfec=1
    m=video <%=videoPort %> RTP/AVPF <%=videoPayload %>
    a=sendrecv
    a=rtcp-mux
    a=rtpmap:<%=videoPayload %> H264/90000
    a=rtcp-fb:<%=videoPayload %> ccm fir
    a=rtcp-fb:<%=videoPayload %> nack
    a=rtcp-fb:<%=videoPayload %> nack pli
    a=rtcp-fb:<%=videoPayload %> goog-remb
    a=rtcp-fb:<%=videoPayload %> transport-cc
    a=fmtp:<%=videoPayload %> level-asymmetry-allowed=1;packetization-mode=1

    ffmpeg output - garbled with some timestamps

    1512775954585 - stderr: ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers
     built with Apple LLVM version 9.0.0 (clang-900.0.38)
     configuration: --prefix=/usr/local/Cellar/ffmpeg/3.4 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-ffplay --enable-libmp3lame --enable-libvpx --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
    1512775954587 - stderr:   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
    1512775954587 - stderr:   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
    Splitting the commandline.
    Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
    Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
    Reading option '-dump' ... matched as option 'dump' (dump each input packet) with argument '1'.
    Reading option '-protocol_whitelist' ...1512775954589 - stderr:  matched as AVOption 'protocol_whitelist' with argument 'file,crypto,udp,rtp,data'.
    Reading option '-analyzeduration' ...1512775954590 - stderr:  matched as AVOption 'analyzeduration' with argument '20M'.
    Reading option '-probesize' ...1512775954590 - stderr:  matched as AVOption 'probesize' with argument '20M'.
    Reading option '-i' ... matched as input url with argument 'data:text/plain;base64,dj0wCm89LSAwIDAgSU4gSVA0IDEyNy4wLjAuMQpzPWUwYzkyZmEwLWRhZDUtMTFlNy04Njg3LTA5MGRkYTk1YjFhNCBmb29ib2FyCmM9SU4gSVA0IDEyNy4wLjAuMQptPWF1ZGlvIDIwMDAwIFJUUC9BVlBGIDEwMAphPXNlbmRyZWN2CmE9cnRjcC1tdXgKYT1ydHBtYXA6MTAwIG9wdXMvNDgwMDAvMgphPWZtdHA6MTAwIG1pbnB0aW1lPTEwOyB1c2VpbmJhbmRmZWM9MQptPXZpZGVvIDIwMDAyIFJUUC9BVlBGIDEwMQphPXNlbmRyZWN2CmE9cnRjcC1tdXgKYT1ydHBtYXA6MTAxIEgyNjQvOTAwMDAKYT1ydGNwLWZiOjEwMSBjY20gZmlyCmE9cnRjcC1mYjoxMDEgbmFjawphPXJ0Y3AtZmI6MTAxIG5hY2sgcGxpCmE9cnRjcC1mYjoxMDEgZ29vZy1yZW1iCmE9cnRjcC1mYjoxMDEgdHJhbnNwb3J0LWNjCmE9Zm10cDoxMDEgbGV2ZWwtYXN5bW1ldHJ5LWFsbG93ZWQ9MTtwYWNrZXRpemF0aW9uLW1vZGU9MTtwcm9maWxlLWxldmVsLWlkPTQyZTAxZgo='.
    Reading option '-fflags' ...1512775954591 - stderr:  matched as AVOption 'fflags' with argument '+genpts'.
    Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'copy'.
    Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'aac'.
    Reading option '-vsync' ... matched as option 'vsync' (video sync method) with argument '0'.
    Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:0,0:1'.
    Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:1,0:1'.
    Reading option '-bsf:v' ... matched as option 'bsf' (A comma-separated list of bitstream filters) with argument 'h264_mp4toannexb'.
    Reading option '-start_number' ...1512775954591 - stderr:  matched as AVOption 'start_number' with argument '0'.
    Reading option '-hls_list_size' ...1512775954591 - stderr:  matched as AVOption 'hls_list_size' with argument '2147480000'.
    Reading option '-hls_wrap' ... matched as AVOption 'hls_wrap' with argument '0'.
    Reading option '-hls_time' ...1512775954591 - stderr:  matched as AVOption 'hls_time' with argument '10'.
    Reading option '/tmp/archive/e0c92fa0-dad5-11e7-8687-090dda95b1a4_10e1c990-dc70-11e7-888d-9f39ca0c79bc/1512775954465.m3u8' ... matched as output url.
    Finished splitting the commandline.
    Parsing a group of options: global .
    Applying option y (overwrite output files) with argument 1.
    1512775954592 - stderr: Applying option loglevel (set logging level) with argument debug.
    Applying option dump (dump each input packet) with argument 1.
    Applying option vsync (video sync method) with argument 0.
    Successfully parsed a group of options.
    Parsing a group of options: input url data:text/plain;base64,dj0wCm89LSAwIDAgSU4gSVA0IDEyNy4wLjAuMQpzPWUwYzkyZmEwLWRhZDUtMTFlNy04Njg3LTA5MGRkYTk1YjFhNCBmb29ib2FyCmM9SU4gSVA0IDEyNy4wLjAuMQptPWF1ZGlvIDIwMDAwIFJUUC9BVlBGIDEwMAphPXNlbmRyZWN2CmE9cnRjcC1tdXgKYT1ydHBtYXA6MTAwIG9wdXMvNDgwMDAvMgphPWZtdHA6MTAwIG1pbnB0aW1lPTEwOyB1c2VpbmJhbmRmZWM9MQptPXZpZGVvIDIwMDAyIFJUUC9BVlBGIDEwMQphPXNlbmRyZWN2CmE9cnRjcC1tdXgKYT1ydHBtYXA6MTAxIEgyNjQvOTAwMDAKYT1ydGNwLWZiOjEwMSBjY20gZmlyCmE9cnRjcC1mYjoxMDEgbmFjawphPXJ0Y3AtZmI6MTAxIG5hY2sgcGxpCmE9cnRjcC1mYjoxMDEgZ29vZy1yZW1iCmE9cnRjcC1mYjoxMDEgdHJhbnNwb3J0LWNjCmE9Zm10cDoxMDEgbGV2ZWwtYXN5bW1ldHJ5LWFsbG93ZWQ9MTtwYWNrZXRpemF0aW9uLW1vZGU9MTtwcm9maWxlLWxldmVsLWlkPTQyZTAxZgo=.
    Successfully parsed a group of options.
    Opening an input file: data:text/plain;base64,dj0wCm89LSAwIDAgSU4gSVA0IDEyNy4wLjAuMQpzPWUwYzkyZmEwLWRhZDUtMTFlNy04Njg3LTA5MGRkYTk1YjFhNCBmb29ib2FyCmM9SU4gSVA0IDEyNy4wLjAuMQptPWF1ZGlvIDIwMDAwIFJUUC9BVlBGIDEwMAphPXNlbmRyZWN2CmE9cnRjcC1tdXgKYT1ydHBtYXA6MTAwIG9wdXMvNDgwMDAvMgphPWZtdHA6MTAwIG1pbnB0aW1lPTEwOyB1c2VpbmJhbmRmZWM9MQptPXZpZGVvIDIwMDAyIFJUUC9BVlBGIDEwMQphPXNlbmRyZWN2CmE9cnRjcC1tdXgKYT1ydHBtYXA6MTAxIEgyNjQvOTAwMDAKYT1ydGNwLWZiOjEwMSBjY20gZmlyCmE9cnRjcC1mYjoxMDEgbmFjawphPXJ0Y3AtZmI6MTAxIG5hY2sgcGxpCmE9cnRjcC1mYjoxMDEgZ29vZy1yZW1iCmE9cnRjcC1mYjoxMDEgdHJhbnNwb3J0LWNjCmE9Zm10cDoxMDEgbGV2ZWwtYXN5bW1ldHJ5LWFsbG93ZWQ9MTtwYWNrZXRpemF0aW9uLW1vZGU9MTtwcm9maWxlLWxldmVsLWlkPTQyZTAxZgo=.
    1512775954592 - stderr: [NULL @ 0x7f81fd000000] Opening 'data:text/plain;base64,dj0wCm89LSAwIDAgSU4gSVA0IDEyNy4wLjAuMQpzPWUwYzkyZmEwLWRhZDUtMTFlNy04Njg3LTA5MGRkYTk1YjFhNCBmb29ib2FyCmM9SU4gSVA0IDEyNy4wLjAuMQptPWF1ZGlvIDIwMDAwIFJUUC9BVlBGIDEwMAphPXNlbmRyZWN2CmE9cnRjcC1tdXgKYT1ydHBtYXA6MTAwIG9wdXMvNDgwMDAvMgphPWZtdHA6MTAwIG1pbnB0aW1lPTEwOyB1c2VpbmJhbmRmZWM9MQptPXZpZGVvIDIwMDAyIFJUUC9BVlBGIDEwMQphPXNlbmRyZWN2CmE9cnRjcC1tdXgKYT1ydHBtYXA6MTAxIEgyNjQvOTAwMDAKYT1ydGNwLWZiOjEwMSBjY20gZmlyCmE9cnRjcC1mYjoxMDEgbmFjawphPXJ0Y3AtZmI6MTAxIG5hY2sgcGxpCmE9cnRjcC1mYjoxMDEgZ29vZy1yZW1iCmE9cnRjcC1mYjoxMDEgdHJhbnNwb3J0LWNjCmE9Zm10cDoxMDEgbGV2ZWwtYXN5bW1ldHJ5LWFsbG93ZWQ9MTtwYWNrZXRpemF0aW9uLW1vZGU9MTtwcm9maWxlLWxldmVsLWlkPTQyZTAxZgo=' for reading
    1512775954593 - stderr: [data @ 0x7f81fca001a0] Content-type: text/plain
    {"level":"info","time":"Dec 8, 2017 11:32 PM","message":"ffmpeg started"}
    1512775954595 - stderr: [sdp @ 0x7f81fd000000] Format sdp probed with size=2048 and score=50
    1512775954598 - stderr: [sdp @ 0x7f81fd000000] audio codec set to: opus
    [sdp @ 0x7f81fd000000] audio samplerate set to: 48000
    [sdp @ 0x7f81fd000000] audio channels set to: 2
    1512775954639 - stderr: [sdp @ 0x7f81fd000000] video codec set to: h264
    [sdp @ 0x7f81fd000000] RTP Packetization Mode: 1
    [sdp @ 0x7f81fd000000] RTP Profile IDC: 42 Profile IOP: e0 Level: 1f
    [udp @ 0x7f81fcb007e0] end receive buffer size reported is 65536
    [udp @ 0x7f81fbe00180] end receive buffer size reported is 65536
    [sdp @ 0x7f81fd000000] setting jitter buffer size to 500
    [udp @ 0x7f81fbe00680] end receive buffer size reported is 65536
    [udp @ 0x7f81fbe00740] end receive buffer size reported is 65536
    [sdp @ 0x7f81fd000000] setting jitter buffer size to 500
    [sdp @ 0x7f81fd000000] Before avformat_find_stream_info() pos: 479 bytes read:479 seeks:0 nb_streams:2
    {"level":"info","time":"Dec 8, 2017 11:32 PM","message":"new active speaker","activePeer":"9f05d96a-9641-4c63-8f0e-486b98e48eb5"}
    1512775954773 - stderr: [AVBSFContext @ 0x7f81fc8018e0] nal_unit_type: 7, nal_ref_idc: 3
    [AVBSFContext @ 0x7f81fc8018e0] nal_unit_type: 8, nal_ref_idc: 3
    [AVBSFContext @ 0x7f81fc8018e0] nal_unit_type: 5, nal_ref_idc: 3
    1512775954774 - stderr: [h264 @ 0x7f8200000c00] nal_unit_type: 7, nal_ref_idc: 3
    1512775954774 - stderr: [h264 @ 0x7f8200000c00] nal_unit_type: 8, nal_ref_idc: 3
    1512775954774 - stderr: [h264 @ 0x7f8200000c00] nal_unit_type: 5, nal_ref_idc: 3
    1512775954774 - stderr: [h264 @ 0x7f8200000c00] Reinit context to 640x480, pix_fmt: yuv420p
    1512775954801 - stderr: [h264 @ 0x7f8200000c00] nal_unit_type: 1, nal_ref_idc: 3
    1512775954939 - stderr: [h264 @ 0x7f8200000c00] nal_unit_type: 7, nal_ref_idc: 3
    1512775954939 - stderr: [h264 @ 0x7f8200000c00] nal_unit_type: 8, nal_ref_idc: 3
    1512775954940 - stderr: [h264 @ 0x7f8200000c00] nal_unit_type: 5, nal_ref_idc: 3
    1512775955003 - stderr: [h264 @ 0x7f8200000c00] nal_unit_type: 1, nal_ref_idc: 3
    1512775955999 - stderr:     Last message repeated 3 times
    [sdp @ 0x7f81fd000000] All info found
    1512775955999 - stderr: [sdp @ 0x7f81fd000000] rfps: 29.750000 0.019566
    [sdp @ 0x7f81fd000000] rfps: 29.833333 0.015263
    [sdp @ 0x7f81fd000000] rfps: 29.916667 0.011503
    1512775955999 - stderr: [sdp @ 0x7f81fd000000] rfps: 30.000000 0.008285
    [sdp @ 0x7f81fd000000] rfps: 31.000000 0.011990
       Last message repeated 1 times
    [sdp @ 0x7f81fd000000] rfps: 29.970030 0.009380
    [sdp @ 0x7f81fd000000] After avformat_find_stream_info() pos: 479 bytes read:479 seeks:0 frames:98
    1512775956000 - stderr: Input #0, sdp, from 'data:text/plain;base64,dj0wCm89LSAwIDAgSU4gSVA0IDEyNy4wLjAuMQpzPWUwYzkyZmEwLWRhZDUtMTFlNy04Njg3LTA5MGRkYTk1YjFhNCBmb29ib2FyCmM9SU4gSVA0IDEyNy4wLjAuMQptPWF1ZGlvIDIwMDAwIFJUUC9BVlBGIDEwMAphPXNlbmRyZWN2CmE9cnRjcC1tdXgKYT1ydHBtYXA6MTAwIG9wdXMvNDgwMDAvMgphPWZtdHA6MTAwIG1pbnB0aW1lPTEwOyB1c2VpbmJhbmRmZWM9MQptPXZpZGVvIDIwMDAyIFJUUC9BVlBGIDEwMQphPXNlbmRyZWN2CmE9cnRjcC1tdXgKYT1ydHBtYXA6MTAxIEgyNjQvOTAwMDAKYT1ydGNwLWZiOjEwMSBjY20gZmlyCmE9cnRjcC1mYjoxMDEgbmFjawphPXJ0Y3AtZmI6MTAxIG5hY2sgcGxpCmE9cnRjcC1mYjoxMDEgZ29vZy1yZW1iCmE9cnRjcC1mYjoxMDEgdHJhbnNwb3J0LWNjCmE9Zm10cDoxMDEgbGV2ZWwtYXN5bW1ldHJ5LWFsbG93ZWQ9MTtwYWNrZXRpemF0aW9uLW1vZGU9MTtwcm9maWxlLWxldmVsLWlkPTQyZTAxZgo=':
    1512775956000 - stderr:   Metadata:
       title           : e0c92fa0-dad5-11e7-8687-090dda95b1a4 fooboar
     Duration: N/A, start: 0.000000, bitrate: N/A
       Stream #0:0, 70, 1/48000: Audio: opus, 48000 Hz, stereo, fltp1512775956000 - stderr:
       Stream #0:1, 28, 1/90000: Video: h264 (Constrained Baseline), 1 reference frame, yuv420p(progressive, left), 640x480, 0/1, 30 tbr, 90k tbn, 180k tbc
    1512775956000 - stderr: Successfully opened the file.
    Parsing a group of options: output url /tmp/archive/e0c92fa0-dad5-11e7-8687-090dda95b1a4_10e1c990-dc70-11e7-888d-9f39ca0c79bc/1512775954465.m3u8.
    Applying option vcodec (force video codec ('copy' to copy stream)) with argument copy.
    Applying option acodec (force audio codec ('copy' to copy stream)) with argument aac.
    Applying option map (set input stream mapping) with argument 0:0,0:1.
    Applying option map (set input stream mapping) with argument 0:1,0:1.
    Applying option bsf:v (A comma-separated list of bitstream filters) with argument h264_mp4toannexb.
    Successfully parsed a group of options.
    1512775956000 - stderr: Opening an output file: /tmp/archive/e0c92fa0-dad5-11e7-8687-090dda95b1a4_10e1c990-dc70-11e7-888d-9f39ca0c79bc/1512775954465.m3u8.
    1512775956000 - stderr: Successfully opened the file.
    1512775956001 - stderr: [AVBSFContext @ 0x7f81fcb020a0] The input looks like it is Annex B already
    Stream mapping:
    1512775956001 - stderr:   Stream #0:0 -> #0:0 [sync #0:1] (opus (native) -> aac (native))
     Stream #0:1 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    stream #0:
     keyframe=1
     duration=0.000
     dts=0.000  pts=0.000
     size=82
    1512775956001 - stderr: [SWR @ 0x7f820001e600] Using fltp internally between filters
    1512775956002 - stderr: detected 8 logical cores
    1512775956003 - stderr: [graph_0_in_0_0 @ 0x7f81fc90dfc0] Setting 'time_base' to value '1/48000'
    [graph_0_in_0_0 @ 0x7f81fc90dfc0] Setting 'sample_rate' to value '48000'
    1512775956003 - stderr: [graph_0_in_0_0 @ 0x7f81fc90dfc0] Setting 'sample_fmt' to value 'fltp'
    [graph_0_in_0_0 @ 0x7f81fc90dfc0] Setting 'channel_layout' to value '0x3'
    [graph_0_in_0_0 @ 0x7f81fc90dfc0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x3
    [format_out_0_0 @ 0x7f81fc914da0] Setting 'sample_fmts' to value 'fltp'
    [format_out_0_0 @ 0x7f81fc914da0] Setting 'sample_rates' to value '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
    1512775956004 - stderr: [AVFilterGraph @ 0x7f81fbd02200] query_formats: 4 queried, 9 merged, 0 already done, 0 delayed
    1512775956007 - stderr: [hls @ 0x7f81fd80f000] Opening '/tmp/archive/e0c92fa0-dad5-11e7-8687-090dda95b1a4_10e1c990-dc70-11e7-888d-9f39ca0c79bc/15127759544650.ts' for writing
    [file @ 0x7f81fbf01ee0] Setting default whitelist 'file,crypto'
    1512775956007 - stderr: [mpegts @ 0x7f81fd877800] muxrate VBR, pcr every 9000 pkts, sdt every 2147483647, pat/pmt every 2147483647 pkts
    Output #0, hls, to '/tmp/archive/e0c92fa0-dad5-11e7-8687-090dda95b1a4_10e1c990-dc70-11e7-888d-9f39ca0c79bc/1512775954465.m3u8':
     Metadata:
       title           : e0c92fa0-dad5-11e7-8687-090dda95b1a4 fooboar
       encoder         : Lavf57.83.100
    1512775956007 - stderr:     Stream #0:0, 0, 1/90000: Audio: aac (LC), 48000 Hz, stereo, fltp, delay 1024, 128 kb/s
       Metadata:
         encoder         : Lavc57.107.100 aac
       Stream #0:1, 0, 1/90000: Video: h264 (Constrained Baseline), 1 reference frame, yuv420p(progressive, left), 640x480 (0x0), 0/1, q=2-31, 30 tbr, 90k tbn, 90k tbc
    cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    1512775956007 - stderr:     Last message repeated 1 times
    stream #0:
     keyframe=1
     duration=0.000
     dts=0.020  pts=0.020
     size=79
    1512775956007 - stderr: cur_dts is invalid (this is harmless if it occurs once at the start per stream)
       Last message repeated 1 times
    stream #0:
     keyframe=1
     duration=0.000
    1512775956007 - stderr:   dts=0.040  pts=0.040
     size=75
    1512775956014 - stderr: cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    stream #0:
     keyframe=1
     duration=0.000
     dts=0.0601512775956014 - stderr:   pts=0.060
     size=81
    1512775956017 - stderr: cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    stream #0:
     keyframe=1
     duration=0.000
     dts=0.080  pts=0.080
     size=76
    1512775956022 - stderr: cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    stream #0:
     keyframe=1
     duration=0.000
     dts=0.1001512775956022 - stderr:   pts=0.100
     size=79
    1512775956023 - stderr: cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    stream #0:
     keyframe=1
    1512775956023 - stderr:   duration=0.000
     dts=0.120  pts=0.120
     size=95
    1512775956024 - stderr: cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    1512775956024 - stderr: stream #0:
     keyframe=1
     duration=0.000
     dts=0.140  pts=0.140
     size=93
    1512775956025 - stderr: cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    stream #0:
     keyframe=1
    1512775956025 - stderr:   duration=0.000
     dts=0.160  pts=0.160
     size=94
    1512775956026 - stderr: cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    stream #1:
     keyframe=1
    1512775956026 - stderr:   duration=0.000
     dts=N/A  pts=N/A
     size=992
    [hls @ 0x7f81fd80f000] Timestamps are unset in a packet for stream 1. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
    1512775956026 - stderr: stream #0:
     keyframe=1
     duration=0.000
    1512775956026 - stderr:   dts=0.180  pts=0.180
     size=108
    1512775956027 - stderr: stream #1:
     keyframe=0
     duration=0.000
    1512775956027 - stderr:   dts=0.002  pts=0.002
     size=3047
    [hls @ 0x7f81fd80f000] pkt->duration = 0, maybe the hls segment duration will not precise
    stream #0:
     keyframe=1
     duration=0.000
     dts=0.200  pts=0.200
     size=89
    1512775956060 - stderr: stream #0:
     keyframe=1
     duration=0.000
     dts=0.220  pts=0.220
     size=73
    stream #0:
     keyframe=1
     duration=0.000
     dts=0.240  pts=0.240
     size=78
    stream #0:
     keyframe=1
     duration=0.000
     dts=0.260  pts=0.260

    Notice how the first frame for stream #1 (video) starts after a number of audio frames ? Specifically, it starts at stream #0 dts/pts 0.18. In this situation, the a/v sync issue is pretty much unnoticeable, but with a bunch of repros, I’ve determined that the a/v sync offset is always the duration of however long audio frames were sent before the first video frame (sometimes seconds). I’m consistently starting the RTP streams only tens of ms apart, so I can’t control for this variance on the input side.

    After the initial audio frames come in, the first video frame has a dts/pts around 0. What ffmpeg setting would I use to adjust the timestamps accordingly ? I don’t care about losing the starting audio that doesn’t have video, so any solution that would adjust the timestamps works.