Recherche avancée

Médias (1)

Mot : - Tags -/biomaping

Autres articles (46)

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

  • (Dés)Activation de fonctionnalités (plugins)

    18 février 2011, par

    Pour gérer l’ajout et la suppression de fonctionnalités supplémentaires (ou plugins), MediaSPIP utilise à partir de la version 0.2 SVP.
    SVP permet l’activation facile de plugins depuis l’espace de configuration de MediaSPIP.
    Pour y accéder, il suffit de se rendre dans l’espace de configuration puis de se rendre sur la page "Gestion des plugins".
    MediaSPIP est fourni par défaut avec l’ensemble des plugins dits "compatibles", ils ont été testés et intégrés afin de fonctionner parfaitement avec chaque (...)

  • Les statuts des instances de mutualisation

    13 mars 2010, par

    Pour des raisons de compatibilité générale du plugin de gestion de mutualisations avec les fonctions originales de SPIP, les statuts des instances sont les mêmes que pour tout autre objets (articles...), seuls leurs noms dans l’interface change quelque peu.
    Les différents statuts possibles sont : prepa (demandé) qui correspond à une instance demandée par un utilisateur. Si le site a déjà été créé par le passé, il est passé en mode désactivé. publie (validé) qui correspond à une instance validée par un (...)

Sur d’autres sites (9053)

  • I have an application in flask where it streams a camera using ffmpeg, the problem is that I can not display the video from the camera using the GPU [closed]

    17 janvier, par Ruben

    I'll put you in context, I am using flask (python) to display a camera in the browser to stream it, for this I use the following Python code :

    


    command = [
     'ffmpeg',
     '-loglevel', 'warning',
     '-rtsp_transport', 'tcp',
     '-i', self.config['url'],
     '-map', '0:v:0', # fuerzo que solo procese el video
     '-vf', f'fps={self.config["fps"]},scale=640:360:force_original_aspect_ratio=decrease',
     '-c:v', 'h264_nvenc', # especificamos que queremos tirar de la gpu de nvidia
     '-preset', 'p7', # ajusta para la maxima calidad/velocidad (p1 mas rapida pero peor calidad - p7 más lento pero mejor calidad)
     '-qp', self.config['quality'], # control de calidad del codificador (0 [mejor calidad] - 51 [peor calidad])
     '-pix_fmt', 'yuv444p', # se mete explicitamente el formato de pixeles
     '-color_range', 'pc',
     '-an', # desactiva el audio
     '-f', 'image2pipe',
     'pipe:1'
] 

self.process = subprocess.Popen(
   command,
   stdout=subprocess.PIPE,
   stderr=subprocess.PIPE,
   bufsize=10**8
)


    


    The problem is that it does not display the video streaming, but it connects correctly to the camera.

    


    On the other hand, It show me the following warnings, which may have something to do with the display, it's probably the second warning that has to do with the pixel format :

    


    DEBUG :main:FFmpeg [camera1] : Guessed Channel Layout for Input Stream #0.1 : mono
DEBUG :main:FFmpeg [camera1] : [swscaler @ 0x560f70b78680] deprecated pixel format used, make sure you did set range correctly

    


    The server has different encodes installed :

    


    DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders : h264 h264_v4l2m2m h264_qsv h264_cuvid ) (encoders : libx264 libx264rgb h264_nvenc h264_omx h264_qsv h264_v4l2m2m h264_vaapi nvenc nvenc_h264 )

    


    Y uso el h264_nvenc, tambien el servidor tiene soporte de aceleración de hardware con :

    


    libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Hardware acceleration methods :
vdpau
cuda
vaapi
qsv
drm
opencl

    


    Between them h264_nvenc uses cuda

    


    I expand a little on the information it provides me when using h264_nvenc :

    


    Encoder h264_nvenc [NVIDIA NVENC H.264 encoder]:&#xA;    General capabilities: dr1 delay hardware&#xA;    Threading capabilities: none&#xA;    Supported hardware devices: cuda cuda&#xA;    Supported pixel formats: yuv420p nv12 p010le yuv444p p016le yuv444p16le bgr0 rgb0 cuda&#xA;h264_nvenc AVOptions:&#xA;  -preset            <int>        E..V....... Set the encoding preset (from 0 to 18) (default p4)&#xA;     default         0            E..V.......&#xA;     slow            1            E..V....... hq 2 passes&#xA;     medium          2            E..V....... hq 1 pass&#xA;     fast            3            E..V....... hp 1 pass&#xA;     hp              4            E..V.......&#xA;     hq              5            E..V.......&#xA;     bd              6            E..V.......&#xA;     ll              7            E..V....... low latency&#xA;     llhq            8            E..V....... low latency hq&#xA;     llhp            9            E..V....... low latency hp&#xA;     lossless        10           E..V.......&#xA;     losslesshp      11           E..V.......&#xA;     p1              12           E..V....... fastest (lowest quality)&#xA;     p2              13           E..V....... faster (lower quality)&#xA;     p3              14           E..V....... fast (low quality)&#xA;     p4              15           E..V....... medium (default)&#xA;     p5              16           E..V....... slow (good quality)&#xA;     p6              17           E..V....... slower (better quality)&#xA;     p7              18           E..V....... slowest (best quality)&#xA;  -tune              <int>        E..V....... Set the encoding tuning info (from 1 to 4) (default hq)&#xA;     hq              1            E..V....... High quality&#xA;     ll              2            E..V....... Low latency&#xA;     ull             3            E..V....... Ultra low latency&#xA;     lossless        4            E..V....... Lossless&#xA;  -profile           <int>        E..V....... Set the encoding profile (from 0 to 3) (default main)&#xA;     baseline        0            E..V.......&#xA;     main            1            E..V.......&#xA;     high            2            E..V.......&#xA;     high444p        3            E..V.......&#xA;  -level             <int>        E..V....... Set the encoding level restriction (from 0 to 62) (default auto)&#xA;     auto            0            E..V.......&#xA;     1               10           E..V.......&#xA;     1.0             10           E..V.......&#xA;     1b              9            E..V.......&#xA;     1.0b            9            E..V.......&#xA;     1.1             11           E..V.......&#xA;     1.2             12           E..V.......&#xA;     1.3             13           E..V.......&#xA;     2               20           E..V.......&#xA;     2.0             20           E..V.......&#xA;     2.1             21           E..V.......&#xA;     2.2             22           E..V.......&#xA;     3               30           E..V.......&#xA;     3.0             30           E..V.......&#xA;     3.1             31           E..V.......&#xA;     3.2             32           E..V.......&#xA;     4               40           E..V.......&#xA;     4.0             40           E..V.......&#xA;     4.1             41           E..V.......&#xA;     4.2             42           E..V.......&#xA;     5               50           E..V.......&#xA;     5.0             50           E..V.......&#xA;     5.1             51           E..V.......&#xA;     5.2             52           E..V.......&#xA;     6.0             60           E..V.......&#xA;     6.1             61           E..V.......&#xA;     6.2             62           E..V.......&#xA;  -rc                <int>        E..V....... Override the preset rate-control (from -1 to INT_MAX) (default -1)&#xA;     constqp         0            E..V....... Constant QP mode&#xA;     vbr             1            E..V....... Variable bitrate mode&#xA;     cbr             2            E..V....... Constant bitrate mode&#xA;     vbr_minqp       8388612      E..V....... Variable bitrate mode with MinQP (deprecated)&#xA;     ll_2pass_quality 8388616      E..V....... Multi-pass optimized for image quality (deprecated)&#xA;     ll_2pass_size   8388624      E..V....... Multi-pass optimized for constant frame size (deprecated)&#xA;     vbr_2pass       8388640      E..V....... Multi-pass variable bitrate mode (deprecated)&#xA;     cbr_ld_hq       8388616      E..V....... Constant bitrate low delay high quality mode&#xA;     cbr_hq          8388624      E..V....... Constant bitrate high quality mode&#xA;     vbr_hq          8388640      E..V....... Variable bitrate high quality mode&#xA;  -rc-lookahead      <int>        E..V....... Number of frames to look ahead for rate-control (from 0 to INT_MAX) (default 0)&#xA;  -surfaces          <int>        E..V....... Number of concurrent surfaces (from 0 to 64) (default 0)&#xA;  -cbr               <boolean>    E..V....... Use cbr encoding mode (default false)&#xA;  -2pass             <boolean>    E..V....... Use 2pass encoding mode (default auto)&#xA;  -gpu               <int>        E..V....... Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on. (from -2 to INT_MAX) (default any)&#xA;     any             -1           E..V....... Pick the first device available&#xA;     list            -2           E..V....... List the available devices&#xA;  -delay             <int>        E..V....... Delay frame output by the given amount of frames (from 0 to INT_MAX) (default INT_MAX)&#xA;  -no-scenecut       <boolean>    E..V....... When lookahead is enabled, set this to 1 to disable adaptive I-frame insertion at scene cuts (default false)&#xA;  -forced-idr        <boolean>    E..V....... If forcing keyframes, force them as IDR frames. (default false)&#xA;  -b_adapt           <boolean>    E..V....... When lookahead is enabled, set this to 0 to disable adaptive B-frame decision (default true)&#xA;  -spatial-aq        <boolean>    E..V....... set to 1 to enable Spatial AQ (default false)&#xA;  -spatial_aq        <boolean>    E..V....... set to 1 to enable Spatial AQ (default false)&#xA;  -temporal-aq       <boolean>    E..V....... set to 1 to enable Temporal AQ (default false)&#xA;  -temporal_aq       <boolean>    E..V....... set to 1 to enable Temporal AQ (default false)&#xA;  -zerolatency       <boolean>    E..V....... Set 1 to indicate zero latency operation (no reordering delay) (default false)&#xA;  -nonref_p          <boolean>    E..V....... Set this to 1 to enable automatic insertion of non-reference P-frames (default false)&#xA;  -strict_gop        <boolean>    E..V....... Set 1 to minimize GOP-to-GOP rate fluctuations (default false)&#xA;  -aq-strength       <int>        E..V....... When Spatial AQ is enabled, this field is used to specify AQ strength. AQ strength scale is from 1 (low) - 15 (aggressive) (from 1 to 15) (default 8)&#xA;  -cq                <float>      E..V....... Set target quality level (0 to 51, 0 means automatic) for constant quality mode in VBR rate control (from 0 to 51) (default 0)&#xA;  -aud               <boolean>    E..V....... Use access unit delimiters (default false)&#xA;  -bluray-compat     <boolean>    E..V....... Bluray compatibility workarounds (default false)&#xA;  -init_qpP          <int>        E..V....... Initial QP value for P frame (from -1 to 51) (default -1)&#xA;  -init_qpB          <int>        E..V....... Initial QP value for B frame (from -1 to 51) (default -1)&#xA;  -init_qpI          <int>        E..V....... Initial QP value for I frame (from -1 to 51) (default -1)&#xA;  -qp                <int>        E..V....... Constant quantization parameter rate control method (from -1 to 51) (default -1)&#xA;  -weighted_pred     <int>        E..V....... Set 1 to enable weighted prediction (from 0 to 1) (default 0)&#xA;  -coder             <int>        E..V....... Coder type (from -1 to 2) (default default)&#xA;     default         -1           E..V.......&#xA;     auto            0            E..V.......&#xA;     cabac           1            E..V.......&#xA;     cavlc           2            E..V.......&#xA;     ac              1            E..V.......&#xA;     vlc             2            E..V.......&#xA;  -b_ref_mode        <int>        E..V....... Use B frames as references (from 0 to 2) (default disabled)&#xA;     disabled        0            E..V....... B frames will not be used for reference&#xA;     each            1            E..V....... Each B frame will be used for reference&#xA;     middle          2            E..V....... Only (number of B frames)/2 will be used for reference&#xA;  -a53cc             <boolean>    E..V....... Use A53 Closed Captions (if available) (default true)&#xA;  -dpb_size          <int>        E..V....... Specifies the DPB size used for encoding (0 means automatic) (from 0 to INT_MAX) (default 0)&#xA;  -multipass         <int>        E..V....... Set the multipass encoding (from 0 to 2) (default disabled)&#xA;     disabled        0            E..V....... Single Pass&#xA;     qres            1            E..V....... Two Pass encoding is enabled where first Pass is quarter resolution&#xA;     fullres         2            E..V....... Two Pass encoding is enabled where first Pass is full resolution&#xA;  -ldkfs             <int>        E..V....... Low delay key frame scale; Specifies the Scene Change frame size increase allowed in case of single frame VBV and CBR (from 0 to 255) (default 0)&#xA;</int></int></int></boolean></int></int></int></int></int></int></int></boolean></boolean></float></int></boolean></boolean></boolean></boolean></boolean></boolean></boolean></boolean></boolean></boolean></int></int></boolean></boolean></int></int></int></int></int></int></int>

    &#xA;

    If anyone has some idea or needs more information to help me, I would appreciate it.

    &#xA;

  • Invalid data stream in media could not be discarded by FFMPEG. Why is it staying and how to discard it ?

    5 décembre 2020, par Link-akro

    I have downloaded a [short media][1] i intend to convert then i will use the result as basis to practice and test any and all FFMPEG commands i learn or use later.

    &#xA;

    That video seems to have an unknown invalid stream which never disappears no matter everything i tried to discard it. When i try to work with it later i get various problems like missing codec or no stream which is not the focus here but the reason why i got stubborn to remove the things i cannot deal with.

    &#xA;

    The following probing prints a warning in yellow color on last row.

    &#xA;

     > ffprobe -hide_banner -show_streams Movie_Countdown-youtube_I1vMKZ1kvg0.mov&#xA;&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;Movie_Countdown-youtube_I1vMKZ1kvg0.mov&#x27;:&#xA;  Metadata:&#xA;    major_brand     : qt&#xA;    minor_version   : 537199360&#xA;    compatible_brands: qt&#xA;    creation_time   : 2015-05-20T13:45:55.000000Z&#xA;  Duration: 00:00:10.00, start: 0.000000, bitrate: 11474 kb/s&#xA;    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 9930 kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 25 tbn, 50 tbc (default)&#xA;    Metadata:&#xA;      creation_time   : 2015-05-20T13:45:55.000000Z&#xA;      handler_name    : Apple Video Media Handler&#xA;      encoder         : H.264&#xA;      timecode        : 00:00:00:00&#xA;    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)&#xA;    Metadata:&#xA;      creation_time   : 2015-05-20T13:45:56.000000Z&#xA;      handler_name    : Apple Sound Media Handler&#xA;      timecode        : 00:00:00:00&#xA;    Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)&#xA;    Metadata:&#xA;      creation_time   : 2015-05-20T13:46:11.000000Z&#xA;      handler_name    : Time Code Media Handler&#xA;      timecode        : 00:00:00:00&#xA;Unsupported codec with id 0 for input stream 2&#xA;

    &#xA;

    Below the streams output. I split the text so you see the warning without searching in the middle.

    &#xA;

    [STREAM]&#xA;index=0&#xA;codec_name=h264&#xA;codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10&#xA;profile=Main&#xA;codec_type=video&#xA;codec_time_base=1/50&#xA;codec_tag_string=avc1&#xA;codec_tag=0x31637661&#xA;width=1920&#xA;height=1080&#xA;coded_width=1920&#xA;coded_height=1088&#xA;closed_captions=0&#xA;has_b_frames=0&#xA;sample_aspect_ratio=1:1&#xA;display_aspect_ratio=16:9&#xA;pix_fmt=yuv420p&#xA;level=40&#xA;color_range=tv&#xA;color_space=bt709&#xA;color_transfer=bt709&#xA;color_primaries=bt709&#xA;chroma_location=left&#xA;field_order=unknown&#xA;timecode=N/A&#xA;refs=1&#xA;is_avc=true&#xA;nal_length_size=4&#xA;id=N/A&#xA;r_frame_rate=25/1&#xA;avg_frame_rate=25/1&#xA;time_base=1/25&#xA;start_pts=0&#xA;start_time=0.000000&#xA;duration_ts=250&#xA;duration=10.000000&#xA;bit_rate=9930739&#xA;max_bit_rate=N/A&#xA;bits_per_raw_sample=8&#xA;nb_frames=250&#xA;nb_read_frames=N/A&#xA;nb_read_packets=N/A&#xA;DISPOSITION:default=1&#xA;DISPOSITION:dub=0&#xA;DISPOSITION:original=0&#xA;DISPOSITION:comment=0&#xA;DISPOSITION:lyrics=0&#xA;DISPOSITION:karaoke=0&#xA;DISPOSITION:forced=0&#xA;DISPOSITION:hearing_impaired=0&#xA;DISPOSITION:visual_impaired=0&#xA;DISPOSITION:clean_effects=0&#xA;DISPOSITION:attached_pic=0&#xA;DISPOSITION:timed_thumbnails=0&#xA;TAG:creation_time=2015-05-20T13:45:55.000000Z&#xA;TAG:language=eng&#xA;TAG:handler_name=Apple Video Media Handler&#xA;TAG:encoder=H.264&#xA;TAG:timecode=00:00:00:00&#xA;[/STREAM]&#xA;[STREAM]&#xA;index=1&#xA;codec_name=pcm_s16le&#xA;codec_long_name=PCM signed 16-bit little-endian&#xA;profile=unknown&#xA;codec_type=audio&#xA;codec_time_base=1/48000&#xA;codec_tag_string=sowt&#xA;codec_tag=0x74776f73&#xA;sample_fmt=s16&#xA;sample_rate=48000&#xA;channels=2&#xA;channel_layout=stereo&#xA;bits_per_sample=16&#xA;id=N/A&#xA;r_frame_rate=0/0&#xA;avg_frame_rate=0/0&#xA;time_base=1/48000&#xA;start_pts=0&#xA;start_time=0.000000&#xA;duration_ts=480000&#xA;duration=10.000000&#xA;bit_rate=1536000&#xA;max_bit_rate=N/A&#xA;bits_per_raw_sample=N/A&#xA;nb_frames=480000&#xA;nb_read_frames=N/A&#xA;nb_read_packets=N/A&#xA;DISPOSITION:default=1&#xA;DISPOSITION:dub=0&#xA;DISPOSITION:original=0&#xA;DISPOSITION:comment=0&#xA;DISPOSITION:lyrics=0&#xA;DISPOSITION:karaoke=0&#xA;DISPOSITION:forced=0&#xA;DISPOSITION:hearing_impaired=0&#xA;DISPOSITION:visual_impaired=0&#xA;DISPOSITION:clean_effects=0&#xA;DISPOSITION:attached_pic=0&#xA;DISPOSITION:timed_thumbnails=0&#xA;TAG:creation_time=2015-05-20T13:45:56.000000Z&#xA;TAG:language=eng&#xA;TAG:handler_name=Apple Sound Media Handler&#xA;TAG:timecode=00:00:00:00&#xA;[/STREAM]&#xA;[STREAM]&#xA;index=2&#xA;codec_name=unknown&#xA;codec_long_name=unknown&#xA;profile=unknown&#xA;codec_type=data&#xA;codec_tag_string=tmcd&#xA;codec_tag=0x64636d74&#xA;id=N/A&#xA;r_frame_rate=0/0&#xA;avg_frame_rate=25/1&#xA;time_base=1/25&#xA;start_pts=0&#xA;start_time=0.000000&#xA;duration_ts=250&#xA;duration=10.000000&#xA;bit_rate=3&#xA;max_bit_rate=N/A&#xA;bits_per_raw_sample=N/A&#xA;nb_frames=1&#xA;nb_read_frames=N/A&#xA;nb_read_packets=N/A&#xA;DISPOSITION:default=1&#xA;DISPOSITION:dub=0&#xA;DISPOSITION:original=0&#xA;DISPOSITION:comment=0&#xA;DISPOSITION:lyrics=0&#xA;DISPOSITION:karaoke=0&#xA;DISPOSITION:forced=0&#xA;DISPOSITION:hearing_impaired=0&#xA;DISPOSITION:visual_impaired=0&#xA;DISPOSITION:clean_effects=0&#xA;DISPOSITION:attached_pic=0&#xA;DISPOSITION:timed_thumbnails=0&#xA;TAG:creation_time=2015-05-20T13:46:11.000000Z&#xA;TAG:language=eng&#xA;TAG:handler_name=Time Code Media Handler&#xA;TAG:timecode=00:00:00:00&#xA;[/STREAM]&#xA;

    &#xA;

    I scaled it down and recoded it for starters and i tried to discard the data stream with -dn and failed other methods i will mention at the end.&#xA;The output so far suggests that discarding should have worked since alternative datas are 0kB and no stream 2 is listed.

    &#xA;

     > ffmpeg -hide_banner -dn -i C:\Users\admin-dix\Downloads\Movie_Countdown-youtube_I1vMKZ1kvg0.mov -vf "scale=h=450:w=800" -f mp4 -c:a aac -c:v libx264 mov_countdown.mp4&#xA;&#xA;Output #0, mp4, to &#x27;mov_countdown.mp4&#x27;:&#xA;  Metadata:&#xA;    major_brand     : qt&#xA;    minor_version   : 537199360&#xA;    compatible_brands: qt&#xA;    encoder         : Lavf58.45.100&#xA;    Stream #0:0(eng): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 800x450 [SAR 1:1 DAR 16:9], q=-1--1, 0.04 fps, 12800 tbn, 25 tbc (default)&#xA;    Metadata:&#xA;      creation_time   : 2015-05-20T13:45:55.000000Z&#xA;      handler_name    : Apple Video Media Handler&#xA;      timecode        : 00:00:00:00&#xA;      encoder         : Lavc58.91.100 libx264&#xA;    Side data:&#xA;      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A&#xA;    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)&#xA;    Metadata:&#xA;      creation_time   : 2015-05-20T13:45:56.000000Z&#xA;      handler_name    : Apple Sound Media Handler&#xA;      timecode        : 00:00:00:00&#xA;      encoder         : Lavc58.91.100 aac&#xA;frame=  250 fps= 43 q=-1.0 Lsize=     342kB time=00:00:10.00 bitrate= 280.1kbits/s speed= 1.7x&#xA;video:175kB audio:159kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.710857%&#xA;

    &#xA;

    Then ffprobe disagrees, there is still the stream and the warning.

    &#xA;

    ffprobe mov_countdown.mp4&#xA;&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;mov_countdown.mp4&#x27;:&#xA;  Metadata:&#xA;    major_brand     : isom&#xA;    minor_version   : 512&#xA;    compatible_brands: isomiso2avc1mp41&#xA;    encoder         : Lavf58.45.100&#xA;  Duration: 00:00:10.02, start: 0.000000, bitrate: 279 kb/s&#xA;    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 800x450 [SAR 1:1 DAR 16:9], 142 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)&#xA;    Metadata:&#xA;      handler_name    : Apple Video Media Handler&#xA;      timecode        : 00:00:00:00&#xA;    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 129 kb/s (default)&#xA;    Metadata:&#xA;      handler_name    : Apple Sound Media Handler&#xA;    Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s&#xA;    Metadata:&#xA;      handler_name    : Apple Video Media Handler&#xA;      timecode        : 00:00:00:00&#xA;Unsupported codec with id 0 for input stream 2&#xA;

    &#xA;

    I tried negative mapping as per this answer -map 0:d which failed. I did not understand -discard option as ffmpeg documentation refers to from the -vn,-an,-dn entries as it does not specify a stream.

    &#xA;

    Why does it do that and how can i remove that stream i do not know and do not want to care about in future tests ?

    &#xA;

    [1] : Clean Retro Movie Countdown - YouTube from Philippe Moesch https://www.youtube.com/watch?v=I1vMKZ1kvg0

    &#xA;

  • FFmpeg remove silence with exact duration detected by detect silence

    17 mars 2021, par dav

    I have an audio file, that have some silences, which I am detecting with ffmpeg detectsilence and then trying to remove with removesilence, however there is some strange behavior. Specifically :

    &#xA;

    1) File's Basic info based on ffprobe show_streams

    &#xA;

    Input #0, mp3, from &#x27;my_file.mp3&#x27;:&#xA;  Metadata:&#xA;    encoder         : Lavf58.64.100&#xA;  Duration: 00:00:25.22, start: 0.046042, bitrate: 32 kb/s&#xA;    Stream #0:0: Audio: mp3, 24000 Hz, mono, fltp, 32 kb/s&#xA;

    &#xA;

    2) Using detectsilence

    &#xA;

    ffmpeg -i my_file.mp3 -af silencedetect=noise=-50dB:d=0.2 -f null -&#xA;

    &#xA;

    I get this result

    &#xA;

    [mp3float @ 000001ee50074280] overread, skip -7 enddists: -1 -1&#xA;[silencedetect @ 000001ee5008a1c0] silence_start: 6.21417&#xA;[silencedetect @ 000001ee5008a1c0] silence_end: 6.91712 | silence_duration: 0.702958&#xA;[silencedetect @ 000001ee5008a1c0] silence_start: 16.44&#xA;[silencedetect @ 000001ee5008a1c0] silence_end: 17.1547 | silence_duration: 0.714708&#xA;[mp3float @ 000001ee50074280] overread, skip -10 enddists: -3 -3&#xA;[mp3float @ 000001ee50074280] overread, skip -5 enddists: -4 -4&#xA;[silencedetect @ 000001ee5008a1c0] silence_start: 24.4501&#xA;size=N/A time=00:00:25.17 bitrate=N/A speed=1.32e&#x2B;03x&#xA;video:0kB audio:1180kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown&#xA;[silencedetect @ 000001ee5008a1c0] silence_end: 25.176 | silence_duration: 0.725917&#xA;

    &#xA;

    That also match the values and points based on Adobe Audition

    &#xA;

    my file adobe audition silences

    &#xA;

    So far all good.

    &#xA;

    3) Now, based on some calculations (which is based on application's logic on what should be the final duration of the audio) I am trying to delete the silence with "0.725917"s duration. For that, based on ffmpeg docs (https://ffmpeg.org/ffmpeg-filters.html#silencedetect)

    &#xA;

    &#xA;

    Trim all silence encountered from beginning to end where there is more&#xA;than 1 second of silence in audio :&#xA;silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB

    &#xA;

    &#xA;

    I run this command

    &#xA;

    ffmpeg -i my_file.mp3 -af silenceremove=stop_periods=-1:stop_threshold=-50dB:stop_duration=0.72 result1.mp3&#xA;

    &#xA;

    So, I am expecting that it should delete only the silence with "0.725917" duration (the last one in the above image), however it is deleting the silence that starts at 16.44s with duration of "0.714708"s. Please see the following comparison :

    &#xA;

    my file and result1 adobe audition silence comparison

    &#xA;

    4) Running detectsilence on result1.mp3 with same options gives even stranger results

    &#xA;

    ffmpeg -i result1.mp3 -af silencedetect=noise=-50dB:d=0.2 -f null -&#xA;

    &#xA;

    result

    &#xA;

    [mp3float @ 0000017723404280] overread, skip -5 enddists: -4 -4&#xA;[silencedetect @ 0000017723419540] silence_start: 6.21417&#xA;[silencedetect @ 0000017723419540] silence_end: 6.92462 | silence_duration: 0.710458&#xA;[mp3float @ 0000017723404280] overread, skip -7 enddists: -6 -6&#xA;[mp3float @ 0000017723404280] overread, skip -7 enddists: -2 -2&#xA;[mp3float @ 0000017723404280] overread, skip -6 enddists: -1 -1&#xA;    Last message repeated 1 times&#xA;[silencedetect @ 0000017723419540] silence_start: 23.7308&#xA;size=N/A time=00:00:24.45 bitrate=N/A speed=1.33e&#x2B;03x&#xA;video:0kB audio:1146kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown&#xA;[silencedetect @ 0000017723419540] silence_end: 24.456 | silence_duration: 0.725167&#xA;

    &#xA;

    So, the results are :

    &#xA;

      &#xA;
    • With command to remove silences that are longer than "0.72 second", a silence that was "0.714708"s, got removed and - a silence with "0.725917"s remained as is (well, actually changed a little - as per 3rd point)
    • &#xA;

    • The first silence that had started at "6.21417" and had a duration of "0.702958"s, suddenly now has a duration of "0.710458"s
    • &#xA;

    • The 3rd silence that had started at "24.4501" (which now starts at 23.7308 - obviously because the 2nd silence was removed) and had a duration of "0.725917", now suddenly is "0.725167"s (this one is not a big difference, but still why even removing other silence, this silence's duration should change at all).
    • &#xA;

    &#xA;

    Accordingly the expected results are :

    &#xA;

      &#xA;
    • Only the silences that match the provided condition (stop_duration=0.72) should be removed. In this specific example only the last one, but in general any silence that matches the condition of the length - irrelevant of their positioning (start, end or in the middle)
    • &#xA;

    • Other silences should remain with same exact duration they were before
    • &#xA;

    &#xA;

    FFMpeg : 4.2.4-1ubuntu0.1, Ubuntu : 20.04.2

    &#xA;

    Some attempts and results, while playing with ffmpeg options

    &#xA;

    a)

    &#xA;

    ffmpeg -i my_file.mp3 -af silenceremove=stop_periods=-1:stop_threshold=-50dB:stop_duration=0.72:detection=peak tmp1.mp3&#xA;

    &#xA;

    result :&#xA;First and second silences are removed, 3rd silence's duration remains exactly the same

    &#xA;

    b)

    &#xA;

    ffmpeg -i my_file.mp3 -af silenceremove=stop_periods=-1:stop_threshold=-50dB:stop_duration=0.71 tmp_0.71.mp3&#xA;

    &#xA;

    result :&#xA;First and second silences are removed, 3rd silence remains, but the duration becomes "0.72075"s

    &#xA;

    c)

    &#xA;

    ffmpeg -i my_file.mp3 -af silenceremove=stop_periods=-1:stop_threshold=-50dB:stop_duration=0.7 tmp_0.7.mp3&#xA;

    &#xA;

    result :&#xA;all 3 silence are removed

    &#xA;

    d) the edge case

    &#xA;

    this command still removes the second silence (after which the first silence become exactly as in point #4 and last silence becomes "0.721375")

    &#xA;

    ffmpeg -i my_file.mp3 -af silenceremove=stop_periods=-1:stop_threshold=-50dB:stop_duration=0.72335499999 tmp_0.72335499999.mp3&#xA;

    &#xA;

    but this one, again does not remove any silence :

    &#xA;

    ffmpeg -i my_file.mp3 -af silenceremove=stop_periods=-1:stop_threshold=-50dB:stop_duration=0.723355 tmp_0.723355.mp3&#xA;

    &#xA;

    e) window param case 0.03

    &#xA;

    ffmpeg -i my_file.mp3 -af silenceremove=stop_periods=-1:stop_threshold=-50dB:stop_duration=0.72:window=0.03 window_0.03.mp3&#xA;

    &#xA;

    does not remove any silence, but the detect silence

    &#xA;

    ffmpeg -i window_0.03.mp3 -af silencedetect=noise=-50dB:d=0.2 -f null -&#xA;

    &#xA;

    gives this result (compare with silences in result1.mp3 - from point #4 )

    &#xA;

    [mp3float @ 000001c5c8824280] overread, skip -5 enddists: -4 -4&#xA;[silencedetect @ 000001c5c883a040] silence_start: 6.21417&#xA;[silencedetect @ 000001c5c883a040] silence_end: 6.92462 | silence_duration: 0.710458&#xA;[mp3float @ 000001c5c8824280] overread, skip -7 enddists: -6 -6&#xA;[mp3float @ 000001c5c8824280] overread, skip -7 enddists: -2 -2&#xA;[silencedetect @ 000001c5c883a040] silence_start: 16.4424&#xA;[silencedetect @ 000001c5c883a040] silence_end: 17.1555 | silence_duration: 0.713167&#xA;[mp3float @ 000001c5c8824280] overread, skip -6 enddists: -1 -1&#xA;    Last message repeated 1 times&#xA;[silencedetect @ 000001c5c883a040] silence_start: 24.4508&#xA;size=N/A time=00:00:25.17 bitrate=N/A speed=1.24e&#x2B;03x&#xA;video:0kB audio:1180kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown&#xA;[silencedetect @ 000001c5c883a040] silence_end: 25.176 | silence_duration: 0.725167&#xA;

    &#xA;

    f) window case 0.01

    &#xA;

    ffmpeg -i my_file.mp3 -af silenceremove=stop_periods=-1:stop_threshold=-50dB:stop_duration=0.72:window=0.01 window_0.01.mp3&#xA;

    &#xA;

    removes first and second silences, the detect silence with same params has the following result

    &#xA;

    [mp3float @ 000001ea631d4280] overread, skip -5 enddists: -4 -4&#xA;    Last message repeated 1 times&#xA;[mp3float @ 000001ea631d4280] overread, skip -7 enddists: -2 -2&#xA;[mp3float @ 000001ea631d4280] overread, skip -6 enddists: -1 -1&#xA;    Last message repeated 1 times&#xA;[silencedetect @ 000001ea631ea1c0] silence_start: 23.0108&#xA;size=N/A time=00:00:23.73 bitrate=N/A speed=1.2e&#x2B;03x&#xA;video:0kB audio:1113kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown&#xA;[silencedetect @ 000001ea631ea1c0] silence_end: 23.736 | silence_duration: 0.725167&#xA;

    &#xA;


    &#xA;

    Any thoughts, ideas, points are much appreciated.

    &#xA;