Recherche avancée

Médias (3)

Mot : - Tags -/plugin

Autres articles (82)

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

  • Librairies et binaires spécifiques au traitement vidéo et sonore

    31 janvier 2010, par

    Les logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
    Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
    Binaires complémentaires et facultatifs flvtool2 : (...)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (7299)

  • FFMPEG - Zoompan image overlay keep ratio

    4 mai 2018, par Pier Giorgio Misley

    With zoompan I can zoom in and out an image overlayed over a video. My problem is that the image ratio is not respected and the image is stretched in something like 16:9

    The image in the center is a phone vertical picture, but It result like this : this

    Looks like zoompan is trying to stretch to full width and the height to.. something. How can I keep the ratio while zooming ? I tried using sar but it doesn’t work

    Note : I read this post and I probably should set the size, but how can I set it to keep the original one ?

    Edit :

    -i "vid.mov" -loop 1 -t 1 -i "1.png" -filter_complex "[1:v]format=rgba,scale=1440x2560,setsar=1/1,zoompan=z='min(zoom+0.0015,1.5)':s=720x1280:d=7250:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)',fade=in:st=20:d=1:alpha=1,fade=out:st=77:d=1:alpha=1[im];[0][im]overlay=(main_w-overlay_w)/2:(main_h - overlay_h)/2:shortest=1" -pix_fmt yuv420p -c:a copy output_0.mp4

    With this, in some video format/resolutions it works, in others not

    ie : with .mp4 it works, with .mov it doesn’t

    Edit2 :

    here is the log (names here are not truncated, there is the full path instead of file name)

    Error : ffmpeg version N-90893-gcae6f806a6 Copyright (c) 2000-2018 the
    FFmpeg developers

    Error : built with gcc 7.3.0 (GCC)

    Error : configuration : —enable-gpl —enable-version3 —enable-sdl2
    —enable-bzlib —enable-fontconfig —enable-gnutls —enable-iconv —enable-libass —enable-libbluray —enable-libfreetype —enable-libmp3lame —enable-libopencore-amrnb —enable-libopencore-amrwb —enable-libopenjpeg —enable-libopus —enable-libshine —enable-libsnappy —enable-libsoxr —enable-libtheora —enable-libtwolame —enable-libvpx —enable-libwavpack —enable-libwebp —enable-libx264 —enable-libx265 —enable-libxml2 —enable-libzimg —enable-lzma —enable-zlib —enable-gmp —enable-libvidstab —enable-libvorbis —enable-libvo-amrwbenc —enable-libmysofa —enable-libspeex —enable-libxvid —enable-libaom —enable-libmfx —enable-amf —enable-ffnvcodec —enable-cuvid —enable-d3d11va —enable-nvenc —enable-nvdec —enable-dxva2 —enable-avisynth

    Error : libavutil 56. 17.100 / 56. 17.100

    Error : libavcodec 58. 19.100 / 58. 19.100

    Error : libavformat 58. 13.100 / 58. 13.100

    Error : libavdevice 58. 4.100 / 58. 4.100

    Error : libavfilter 7. 21.100 / 7. 21.100

    Error : libswscale 5. 2.100 / 5. 2.100

    Error : libswresample 3. 2.100 / 3. 2.100

    Error : libpostproc 55. 2.100 / 55. 2.100

    Error : Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
    ’C :\AREA\Progetti\VideoEditingDefunti\samples\video\template_religioso_2.mp4’ :

    Error : Metadata :

    Error : major_brand : isom

    Error : minor_version : 512

    Error : compatible_brands : isomiso2avc1mp41

    Error : encoder : Lavf58.13.100

    Error : Duration : 00:02:12.50, start : 0.000000, bitrate : 3149 kb/s

    Error : Stream #0:0(und) : Video : h264 (High) (avc1 / 0x31637661),
    yuv420p(tv, bt709), 1024x600 [SAR 1:1 DAR 128:75], 3014 kb/s, 24 fps,
    24 tbr, 19200 tbn, 50 tbc (default)

    Error : Metadata :

    Error : handler_name : VideoHandler

    Error : timecode : 00:00:00:00

    Error : Stream #0:1(und) : Audio : aac (LC) (mp4a / 0x6134706D),
    44100 Hz, stereo, fltp, 129 kb/s (default)

    Error : Metadata :

    Error : handler_name : SoundHandler

    Error : Stream #0:2(eng) : Data : none (tmcd / 0x64636D74)

    Error : Metadata :

    Error : handler_name : TimeCodeHandler

    Error : timecode : 00:00:00:00

    Error : Input #1, png_pipe, from
    ’C :\AREA\Progetti\VideoEditingDefunti\samples\in\esempio1\1 s.png’ :

    Error : Duration : N/A, bitrate : N/A

    Error : Stream #1:0 : Video : png, rgb24(pc), 720x1280, 25 fps, 25
    tbr, 25 tbn, 25 tbc

    Error : Stream mapping :

    Error : Stream #0:0 (h264) -> overlay:main

    Error : Stream #1:0 (png) -> format

    Error : overlay -> Stream #0:0 (libx264)

    Error : Stream #0:1 -> #0:1 (copy)

    Error : Press [q] to stop, [?] for help

    Error : [libx264 @ 000002415f7f8280] using SAR=1/1

    Error : [libx264 @ 000002415f7f8280] using cpu capabilities : MMX2
    SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2

    Error : [libx264 @ 000002415f7f8280] profile High, level 3.1

    Error : [libx264 @ 000002415f7f8280] 264 - core 155 r2901 7d0ff22 -
    H.264/MPEG-4 AVC codec - Copyleft 2003-2018 -
    http://www.videolan.org/x264.html - options : cabac=1 ref=3
    deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
    mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0
    deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12
    lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0
    bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
    b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250
    keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf
    mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40
    aq=1:1.00

    Error : Output #0, mp4, to
    ’C :\AREA\Progetti\VideoEditingDefunti\samples\in\esempio1\output_0.mp4’ :

    Error : Metadata :

    Error : major_brand : isom

    Error : minor_version : 512

    Error : compatible_brands : isomiso2avc1mp41

    Error : encoder : Lavf58.13.100

    Error : Stream #0:0 : Video : h264 (libx264) (avc1 / 0x31637661),
    yuv420p, 1024x600 [SAR 1:1 DAR 128:75], q=-1—1, 24 fps, 12288 tbn, 24
    tbc (default)

    Error : Metadata :

    Error : encoder : Lavc58.19.100 libx264

    Error : Side data :

    Error : cpb : bitrate max/min/avg : 0/0/0 buffer size : 0 vbv_delay :
    -1

    Error : Stream #0:1(und) : Audio : aac (LC) (mp4a / 0x6134706D),
    44100 Hz, stereo, fltp, 129 kb/s (default)

    Error : Metadata :

    Error : handler_name : SoundHandler

    Error : [swscaler @ 0000024164404cc0] Warning : data is not aligned !
    This can lead to a speed loss

    Error : frame= 50 fps=0.0 q=0.0 size= 0kB time=00:00:02.39
    bitrate= 0.2kbits/s speed=4.76x

    Error : frame= 107 fps=106 q=28.0 size= 0kB time=00:00:04.76
    bitrate= 0.1kbits/s speed=4.72x

    Error : frame= 170 fps=113 q=28.0 size= 0kB time=00:00:07.38
    bitrate= 0.1kbits/s speed=4.89x

    Error : frame= 236 fps=117 q=28.0 size= 0kB time=00:00:10.14
    bitrate= 0.0kbits/s speed=5.05x

    Error : frame= 308 fps=123 q=28.0 size= 0kB time=00:00:13.14
    bitrate= 0.0kbits/s speed=5.23x

    Error : frame= 381 fps=126 q=28.0 size= 0kB time=00:00:16.18
    bitrate= 0.0kbits/s speed=5.37x

    Error : frame= 453 fps=129 q=28.0 size= 256kB time=00:00:19.17
    bitrate= 109.4kbits/s speed=5.45x

    Error : frame= 524 fps=130 q=28.0 size= 256kB time=00:00:22.12
    bitrate= 94.8kbits/s speed= 5.5x

    Error : frame= 587 fps=129 q=28.0 size= 256kB time=00:00:24.75
    bitrate= 84.7kbits/s speed=5.46x

    Error : frame= 640 fps=127 q=28.0 size= 512kB time=00:00:26.95
    bitrate= 155.6kbits/s speed=5.35x

    Error : frame= 695 fps=125 q=28.0 size= 768kB time=00:00:29.25
    bitrate= 215.1kbits/s speed=5.28x

    Error : frame= 751 fps=124 q=28.0 size= 1024kB time=00:00:31.60
    bitrate= 265.5kbits/s speed=5.22x

    Error : frame= 804 fps=123 q=28.0 size= 1280kB time=00:00:33.80
    bitrate= 310.2kbits/s speed=5.16x

    Error : frame= 856 fps=121 q=28.0 size= 1536kB time=00:00:35.96
    bitrate= 349.8kbits/s speed= 5.1x

    Error : frame= 906 fps=120 q=28.0 size= 1792kB time=00:00:38.05
    bitrate= 385.7kbits/s speed=5.03x

    Error : frame= 954 fps=118 q=28.0 size= 2048kB time=00:00:40.05
    bitrate= 418.9kbits/s speed=4.96x

    Error : frame= 1004 fps=117 q=28.0 size= 2304kB time=00:00:42.14
    bitrate= 447.9kbits/s speed=4.91x

    Error : frame= 1052 fps=116 q=28.0 size= 2560kB time=00:00:44.14
    bitrate= 475.1kbits/s speed=4.85x

    Error : frame= 1107 fps=115 q=28.0 size= 2816kB time=00:00:46.41
    bitrate= 497.0kbits/s speed=4.83x

    Error : frame= 1161 fps=115 q=28.0 size= 3072kB time=00:00:48.66
    bitrate= 517.1kbits/s speed=4.81x

    Error : frame= 1205 fps=113 q=28.0 size= 3584kB time=00:00:50.50
    bitrate= 581.4kbits/s speed=4.75x

    Error : frame= 1250 fps=112 q=28.0 size= 3840kB time=00:00:52.38
    bitrate= 600.5kbits/s speed=4.71x

    Error : frame= 1294 fps=111 q=28.0 size= 4096kB time=00:00:54.21
    bitrate= 618.9kbits/s speed=4.66x

    Error : frame= 1340 fps=110 q=28.0 size= 4608kB time=00:00:56.14
    bitrate= 672.3kbits/s speed=4.62x

    Error : frame= 1384 fps=109 q=28.0 size= 4864kB time=00:00:57.98
    bitrate= 687.2kbits/s speed=4.58x

    Error : frame= 1428 fps=108 q=28.0 size= 5120kB time=00:00:59.81
    bitrate= 701.2kbits/s speed=4.54x

    Error : frame= 1461 fps=107 q=28.0 size= 5376kB time=00:01:01.18
    bitrate= 719.8kbits/s speed=4.47x

    Error : frame= 1503 fps=106 q=28.0 size= 5632kB time=00:01:02.92
    bitrate= 733.2kbits/s speed=4.44x

    Error : frame= 1547 fps=105 q=28.0 size= 5888kB time=00:01:04.76
    bitrate= 744.8kbits/s speed=4.41x

    Error : frame= 1598 fps=105 q=28.0 size= 6144kB time=00:01:06.89
    bitrate= 752.4kbits/s speed= 4.4x

    Error : frame= 1633 fps=104 q=28.0 size= 6400kB time=00:01:08.33
    bitrate= 767.2kbits/s speed=4.35x

    Error : frame= 1676 fps=103 q=28.0 size= 6656kB time=00:01:10.14
    bitrate= 777.3kbits/s speed=4.33x

    Error : frame= 1724 fps=103 q=28.0 size= 6656kB time=00:01:12.14
    bitrate= 755.8kbits/s speed=4.31x

    Error : frame= 1760 fps=102 q=28.0 size= 7168kB time=00:01:13.63
    bitrate= 797.5kbits/s speed=4.28x

    Error : frame= 1784 fps=101 q=28.0 size= 7424kB time=00:01:14.62
    bitrate= 814.9kbits/s speed=4.21x

    Error : frame= 1815 fps= 99 q=28.0 size= 7936kB time=00:01:15.92
    bitrate= 856.2kbits/s speed=4.16x

    Error : frame= 1852 fps= 99 q=28.0 size= 8192kB time=00:01:17.46
    bitrate= 866.4kbits/s speed=4.13x

    Error : frame= 1886 fps= 98 q=28.0 size= 8704kB time=00:01:18.87
    bitrate= 904.0kbits/s speed=4.09x

    Error : frame= 1914 fps= 97 q=28.0 size= 8960kB time=00:01:20.06
    bitrate= 916.8kbits/s speed=4.04x

    Error : frame= 1954 fps= 96 q=28.0 size= 9216kB time=00:01:21.71
    bitrate= 924.0kbits/s speed=4.02x

    Error : frame= 1992 fps= 96 q=28.0 size= 9728kB time=00:01:23.31
    bitrate= 956.5kbits/s speed= 4x

    Error : frame= 2030 fps= 95 q=28.0 size= 9984kB time=00:01:24.89
    bitrate= 963.4kbits/s speed=3.98x

    Error : frame= 2073 fps= 95 q=28.0 size= 10752kB time=00:01:26.68
    bitrate=1016.2kbits/s speed=3.97x

    Error : frame= 2113 fps= 94 q=28.0 size= 11008kB time=00:01:28.35
    bitrate=1020.7kbits/s speed=3.95x

    Error : frame= 2141 fps= 94 q=28.0 size= 11264kB time=00:01:29.51
    bitrate=1030.9kbits/s speed=3.91x

    Error : frame= 2168 fps= 93 q=28.0 size= 11520kB time=00:01:30.62
    bitrate=1041.3kbits/s speed=3.88x

    Error : frame= 2205 fps= 92 q=28.0 size= 12032kB time=00:01:32.18
    bitrate=1069.2kbits/s speed=3.85x

    Error : frame= 2244 fps= 92 q=28.0 size= 12288kB time=00:01:33.80
    bitrate=1073.1kbits/s speed=3.84x

    Error : frame= 2294 fps= 92 q=28.0 size= 12544kB time=00:01:35.87
    bitrate=1071.8kbits/s speed=3.85x

    Error : frame= 2339 fps= 92 q=28.0 size= 12800kB time=00:01:37.75
    bitrate=1072.7kbits/s speed=3.84x

    Error : frame= 2389 fps= 92 q=28.0 size= 12800kB time=00:01:39.84
    bitrate=1050.2kbits/s speed=3.85x

    Error : frame= 2436 fps= 92 q=28.0 size= 13056kB time=00:01:41.79
    bitrate=1050.7kbits/s speed=3.85x

    Error : frame= 2481 fps= 92 q=28.0 size= 13312kB time=00:01:43.67
    bitrate=1051.8kbits/s speed=3.85x

    Error : frame= 2533 fps= 92 q=28.0 size= 13568kB time=00:01:45.83
    bitrate=1050.2kbits/s speed=3.85x

    Error : frame= 2564 fps= 92 q=28.0 size= 13824kB time=00:01:47.13
    bitrate=1057.0kbits/s speed=3.83x

    Error : frame= 2615 fps= 92 q=28.0 size= 14080kB time=00:01:49.27
    bitrate=1055.6kbits/s speed=3.84x

    Error : frame= 2662 fps= 92 q=28.0 size= 14336kB time=00:01:51.22
    bitrate=1055.9kbits/s speed=3.84x

    Error : frame= 2701 fps= 92 q=28.0 size= 14592kB time=00:01:52.84
    bitrate=1059.3kbits/s speed=3.83x

    Error : frame= 2746 fps= 92 q=28.0 size= 14592kB time=00:01:54.72
    bitrate=1041.9kbits/s speed=3.83x

    Error : frame= 2790 fps= 91 q=28.0 size= 14848kB time=00:01:56.56
    bitrate=1043.5kbits/s speed=3.82x

    Error : frame= 2834 fps= 91 q=28.0 size= 15360kB time=00:01:58.35
    bitrate=1063.2kbits/s speed=3.82x

    Error : frame= 2877 fps= 91 q=28.0 size= 15616kB time=00:02:00.18
    bitrate=1064.4kbits/s speed=3.82x

    Error : frame= 2921 fps= 91 q=28.0 size= 15616kB time=00:02:02.02
    bitrate=1048.4kbits/s speed=3.81x

    Error : frame= 2962 fps= 91 q=28.0 size= 15872kB time=00:02:03.71
    bitrate=1051.0kbits/s speed=3.81x

    Error : frame= 3013 fps= 91 q=28.0 size= 16128kB time=00:02:05.85
    bitrate=1049.8kbits/s speed=3.81x

    Error : frame= 3080 fps= 92 q=28.0 size= 16128kB time=00:02:08.63
    bitrate=1027.1kbits/s speed=3.84x

    Error : frame= 3147 fps= 93 q=28.0 size= 16128kB time=00:02:11.42
    bitrate=1005.3kbits/s speed=3.86x

    Error : frame= 3180 fps= 93 q=-1.0 Lsize= 16525kB time=00:02:12.49
    bitrate=1021.7kbits/s speed=3.86x

    Error : video:14336kB audio:2088kB subtitle:0kB other streams:0kB
    global headers:0kB muxing overhead : 0.612608%

    Error : [libx264 @ 000002415f7f8280] frame I:14 Avg QP:16.64 size :
    42662

    Error : [libx264 @ 000002415f7f8280] frame P:1149 Avg QP:20.03 size :
    10088

    Error : [libx264 @ 000002415f7f8280] frame B:2017 Avg QP:21.44 size :
    1235

    Error : [libx264 @ 000002415f7f8280] consecutive B-frames : 2.6% 37.5%
    2.5% 57.4%

    Error : [libx264 @ 000002415f7f8280] mb I I16..4 : 30.9% 57.6% 11.5%

    Error : [libx264 @ 000002415f7f8280] mb P I16..4 : 4.3% 5.9% 0.3%
    P16..4 : 35.2% 9.9% 7.4% 0.0% 0.0% skip:36.9%

    Error : [libx264 @ 000002415f7f8280] mb B I16..4 : 0.3% 0.5% 0.0%
    B16..8 : 19.3% 0.9% 0.1% direct : 2.0% skip:76.9% L0:39.8% L1:55.2%
    BI : 5.0%

    Error : [libx264 @ 000002415f7f8280] 8x8 transform intra:56.7%
    inter:84.0%

    Error : [libx264 @ 000002415f7f8280] coded y,uvDC,uvAC intra : 33.3%
    65.5% 24.9% inter : 10.4% 17.5% 2.4%

    Error : [libx264 @ 000002415f7f8280] i16 v,h,dc,p : 59% 17% 11% 12%

    Error : [libx264 @ 000002415f7f8280] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu : 35%
    15% 33% 2% 3% 3% 3% 3% 2%

    Error : [libx264 @ 000002415f7f8280] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu : 36%
    18% 13% 4% 6% 7% 6% 6% 4%

    Error : [libx264 @ 000002415f7f8280] i8c dc,h,v,p : 52% 17% 24% 7%

    Error : [libx264 @ 000002415f7f8280] Weighted P-Frames : Y:25.6%
    UV:17.5%

    Error : [libx264 @ 000002415f7f8280] ref P L0 : 65.1% 15.7% 14.4% 4.3%
    0.5%

    Error : [libx264 @ 000002415f7f8280] ref B L0 : 89.8% 8.1% 2.1%

    Error : [libx264 @ 000002415f7f8280] ref B L1 : 98.1% 1.9%

    Error : [libx264 @ 000002415f7f8280] kb/s:886.33

    Error :

  • cannot hear audio after saving RTSP stream as ts or avi or mp4 files using ffmpeg command

    28 mai 2022, par ewang

    I am still new to ffmpeg and trying to save RTSP stream from the IP camera (Meraki MV2) via RTSP link (rtsp ://192.168.0.80:9000/live) to local laptop (Windows 10) as ts file, or avi or mp4 files, but none of them can hear sound. In Meraki MV2 camera dashboard audio is enabled
meraki dashboard audio enabled screenshot

    


    And below is the ffmpeg command i used :

    


    ffmpeg -use_wallclock_as_timestamps 1 -rtsp_transport tcp -i rtsp://192.168.0.80:9000/live -f mpegts -b 400k -r 25 -vcodec libx264 -s 640x480 -aspect 4:3 -bufsize 6000k -acodec aac -ab 56k -ac 2 -ar 22050 -bf 0 -level 30 -y record_a_v.ts


    


    In below part of the result log, noticed Steam mapping has a #0:1 -> #0:0 and #0:0 -> #0:1, is it supposed to be crossed or not really ?

    


    Input #0, rtsp, from 'rtsp://192.168.0.80:9000/live':
  Metadata:
    title           : www rtsp live
    comment         : LIVE555 Streaming Media v2017.01.26
  Duration: N/A, start: 1653723857.755958, bitrate: N/A
  Stream #0:0: Audio: aac (LC), 48000 Hz, mono, fltp
  Stream #0:1: Video: h264 (High), yuvj420p(pc, smpte170m, progressive), 1920x1080, 90k tbr, 90k tbn
Stream mapping:
  Stream #0:1 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:0 -> #0:1 (aac (native) -> aac (native))


    


    Here are the last section of the result log :

    


        Last message repeated 4 times
Error while decoding stream #0:0: Invalid argument:00:09.44 bitrate=  79.3kbits/s dup=0 drop=2 speed=1.38x
    Last message repeated 1 times
[aac @ 0000027bec8ee780] Queue input is backward in time
Error while decoding stream #0:0: Invalid argument
[mpegts @ 0000027bee8cfac0] Non-monotonous DTS in output stream 0:1; previous: 868241, current: 867392; changing to 868242. This may result in incorrect timestamps in the output file.
Error while decoding stream #0:0: Invalid argument
    Last message repeated 12 times
Error while decoding stream #0:0: Invalid argument:00:09.90 bitrate= 111.7kbits/s dup=0 drop=2 speed=1.35x
    Last message repeated 6 times
Error while decoding stream #0:0: Invalid argument:00:10.51 bitrate= 121.5kbits/s dup=0 drop=2 speed=1.34x
    Last message repeated 19 times
Error while decoding stream #0:0: Invalid argument:00:11.01 bitrate= 137.9kbits/s dup=0 drop=2 speed=1.31x
    Last message repeated 10 times
Error while decoding stream #0:0: Invalid argument:00:11.51 bitrate= 145.2kbits/s dup=0 drop=2 speed=1.29x
    Last message repeated 9 times
Error while decoding stream #0:0: Invalid argument:00:12.12 bitrate= 154.5kbits/s dup=0 drop=2 speed=1.29x
    Last message repeated 21 times
Error while decoding stream #0:0: Invalid argument:00:12.50 bitrate= 167.7kbits/s dup=0 drop=2 speed=1.26x
    Last message repeated 8 times
Error while decoding stream #0:0: Invalid argument:00:13.08 bitrate= 160.2kbits/s dup=0 drop=2 speed=1.25x
    Last message repeated 11 times
Error while decoding stream #0:0: Invalid argument:00:13.61 bitrate= 154.0kbits/s dup=0 drop=2 speed=1.24x
    Last message repeated 8 times
Error while decoding stream #0:0: Invalid argument:00:14.11 bitrate= 148.5kbits/s dup=0 drop=2 speed=1.23x
    Last message repeated 16 times
Error while decoding stream #0:0: Invalid argument:00:14.61 bitrate= 143.5kbits/s dup=0 drop=2 speed=1.22x
    Last message repeated 10 times
Error while decoding stream #0:0: Invalid argument:00:15.14 bitrate= 138.4kbits/s dup=0 drop=2 speed=1.21x
    Last message repeated 18 times
Error while decoding stream #0:0: Invalid argument:00:15.62 bitrate= 134.2kbits/s dup=0 drop=2 speed= 1.2x
    Last message repeated 6 times
Error while decoding stream #0:0: Invalid argument:00:16.14 bitrate= 129.9kbits/s dup=0 drop=2 speed=1.19x
    Last message repeated 15 times
Error while decoding stream #0:0: Invalid argument:00:16.64 bitrate= 251.9kbits/s dup=0 drop=2 speed=1.19x
    Last message repeated 9 times
Error while decoding stream #0:0: Invalid argument:00:17.11 bitrate= 245.1kbits/s dup=0 drop=2 speed=1.18x
    Last message repeated 15 times
frame=  125 fps=8.3 q=27.0 size=     512kB time=00:00:17.66 bitrate= 237.5kbits/s dup=0 drop=2 speed=1.17x

[q] command received. Exiting.

frame=  125 fps=8.2 q=-1.0 Lsize=     922kB time=00:00:17.75 bitrate= 425.1kbits/s dup=0 drop=2 speed=1.16x
video:843kB audio:2kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 9.064729%
[libx264 @ 0000027bee8cd640] frame I:1     Avg QP:17.27  size: 54983
[libx264 @ 0000027bee8cd640] frame P:124   Avg QP:22.65  size:  6516
[libx264 @ 0000027bee8cd640] mb I  I16..4:  4.2% 60.5% 35.2%
[libx264 @ 0000027bee8cd640] mb P  I16..4:  0.1%  2.4%  0.4%  P16..4: 39.2% 11.9% 10.2%  0.0%  0.0%    skip:35.9%
[libx264 @ 0000027bee8cd640] 8x8 transform intra:77.2% inter:55.0%
[libx264 @ 0000027bee8cd640] coded y,uvDC,uvAC intra: 93.1% 91.5% 65.1% inter: 26.5% 37.1% 6.2%
[libx264 @ 0000027bee8cd640] i16 v,h,dc,p:  8%  2%  8% 81%
[libx264 @ 0000027bee8cd640] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 11%  9% 24%  5% 16% 12% 12%  6%  6%
[libx264 @ 0000027bee8cd640] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25%  9% 16%  6% 11% 14%  6%  6%  6%
[libx264 @ 0000027bee8cd640] i8c dc,h,v,p: 64% 12% 20%  5%
[libx264 @ 0000027bee8cd640] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000027bee8cd640] ref P L0: 77.9% 10.9%  7.7%  3.5%
[libx264 @ 0000027bee8cd640] kb/s:435.85
[aac @ 0000027bec8ee780] Qavg: 65536.000


    


    Can anyone help checking where went wrong ? Thanks

    


  • Using FFMPEG for Bidirectional Voice Communication with Symmetric RTP

    3 février 2024, par Batuhan Öksüz

    I am trying to make a voice communication between two peers. The first peer is my local machine which is behind a symmetric NAT. The second peer is my server running on an AWS EC2 device which has a public IP address. I want to use FFMPEG for sending the audio stream through RTP while at the same time listening to a known port to receive the audio stream the remote peer sends to my device. In order to not deal with NAT traversal issues, I want to be able to use the same IP address and port number I use for sending on my local device for receiving. Is this plausible ? I'm starting to think that this is not possible and here is my rationale :

    


      

    • If my understanding is correct UDP doesn't allow full-duplex communication ; that is, one cannot use one IP:port pair for both sending and receiving data packets at the same time. Is that correct ?
    • 


    • If one wants to bind a socket that is already been bound, the function throws a bind error saying "Address already in use.". I figured there is a UDP option to allow binding to the same port or address even if they are in use. These options are namely SO_REUSEADDR and SO_REUSEPORT. However, this page states that it is only possible if the port is in TIME_WAIT state. So this also supports my suspicion.
    • 


    


    On the other hand, there is symmetric RTP that clearly states a device can receive RTP streams from an address and port that it simultaneously uses to transmit RTP streams from. With exact words of the RFC :

    


    


    A device supports symmetric RTP if it selects, communicates, and uses
IP addresses and port numbers such that, when receiving a
bidirectional RTP media stream on UDP port "A" and IP address "a", it
also transmits RTP media for that stream from the same source UDP
port "A" and IP address "a". That is, it uses the same UDP port to
transmit and receive one RTP stream.

    


    


    


    A device that doesn't support symmetric RTP would transmit RTP from a
different port, or from a different IP address, than the port and IP
address used to receive RTP for that bidirectional media steam.

    


    


    So this is where I get confused. Is symmetric RTP somehow works around the limitations of UDP ? How am I getting this wrong ?

    


    Now going back to FFMPEG and the use of symmetric RTP, I see there is an rtp option we can use to set it up, the so called localrtpport=n. I can find almost no explanation to what it does and how it's useful though. Can anyone help me with that ? As far as I can tell, this option tells FFMPEG to use port "n" as the outbound port when transmitting an RTP stream. So if the receiver transmitted its stream to this port then the problem of symmetric NAT requirement would be resolved. Or so I thought...

    


    To draw you a better picture, here are my FFMPEG commands (I'm trying everything in my local host in these commands) :

    


    # My Mac with en0 IP of 192.168.1.64
ffmpeg \
-hide_banner \
-re \
-fflags +genpts \
-f lavfi -i aevalsrc="sin(400*2*PI*t)" \
-ar 8000 \
-f mulaw \
-f rtp -reuse 1 "rtp://192.168.1.72:9193?reuse=1&localrtpport=16386&localrtcpport=16387" \
-protocol_whitelist udp,rtp \
-i rtp://192.168.1.64:16386 \
audio_signal_with_symmetric_rtp.mp3


    


    Here I am simply generating a fixed sound signal and outputting it in mulaw format through rtp. I am using the 'localrtport' option to set my outbound port and I am expecting to receive the remote peer's stream on the same port. This command starts running and and waits for the incoming stream. As soon as I start transmitting the stream from my Raspberry Pi which is on the same wireless network, I get the dreaded "Address already in use." error and the process terminates. Here is the command I use on the Raspberry :

    


    # My Raspberry Pi with wlan0 IP of 192.168.1.72
ffmpeg \
-hide_banner \
-re \
-f lavfi -i aevalsrc="sin(400*2*PI*t)" \
-ar 8000 \
-f mulaw \
-f rtp "rtp://192.168.1.64:16386?reuse=1&localrtpport=16386"


    


    TLDR

    


    The short form of the question comes down to this : How can I make use of symmetric RTP with FFMPEG, receive a stream from the same port I am actively transmitting another stream from ? Is what I'm asking impossible ? Should I go for an alternate route and try to set up a TURN server for my system ? Any help would be appreciated.