Recherche avancée

Médias (3)

Mot : - Tags -/Valkaama

Autres articles (22)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

Sur d’autres sites (5086)

  • ffmpeg scale doesn't work if destination res is larger than source

    21 décembre 2017, par Vibok

    I just tried ffmpeg filter scale=320x180:force_original_aspect_ratio=disable to resize a 270x480 video into a 320x180 video, and it still keeps aspect ratio. force_original_aspect_ratio=disable got ignored.

    I guess the problem is that the destination width is bigger than the source width, while the destination height is smaller. Because it worked for other videos, even without force_original_aspect_ratio=disable.

    The resulted file is also weird. It says it’s 320x180, while its weight is obliviously smaller than that.

    Here are the video files, original and resized. https://drive.google.com/file/d/1UNXlfwpzoizhx7WOjqn44mlcbQgacOHS/view?usp=sharing

    Here is my command :

    ffmpeg -i 480P_600K_107047752.mp4 -force_key_frames 00:00:03.000 -filter_complex [0:v]scale=320x180:force_original_aspect_ratio=disable,fps=30[vid];[vid]
  • Merge commit '10eb496d9ae94df6f792b0e1d8750738eb3a0952'

    11 novembre 2017, par James Almer
    Merge commit '10eb496d9ae94df6f792b0e1d8750738eb3a0952'
    

    * commit '10eb496d9ae94df6f792b0e1d8750738eb3a0952' :
    vaapi_mpeg2 : Convert to use coded bitstream infrastructure
    mpeg12 : Move finding the best frame rate to common code
    cbs_mpeg2 : Add support for picture display extension
    cbs_h265 : Fix ranges of prediction weight offsets
    cbs_h265 : Fix reading of unknown parameter set extension data
    vaapi_h264 : Fix CPB/DPB delays

    This commit is a noop, see
    94a4048619665e99a19d9e2961254dc9b5c736a7
    9b0c7aa0e446eceec96ba8f4009e004fad29fba3
    686e388bbb6aeef077095a83f84b53d143d44d63
    278c308ceae6b8d7bac1dfc24518821aae603988
    d8928ad6b6e899c409129c8e16b225c09a8a5abb

    Merged-by : James Almer <jamrial@gmail.com>

  • FFmpeg RTSP drop rate increases when frame rate is reduced

    13 avril 2024, par Avishka Perera

    I need to read an RTSP stream, process the images individually in Python, and then write the images back to an RTSP stream. As the RTSP server, I am using Mediamtx [1]. For streaming, I am using FFmpeg [2].

    &#xA;

    I have the following code that works perfectly fine. For simplification purposes, I am streaming three generated images.

    &#xA;

    import time&#xA;import numpy as np&#xA;import subprocess&#xA;&#xA;width, height = 640, 480&#xA;fps = 25&#xA;rtsp_server_address = f"rtsp://localhost:8554/mystream"&#xA;&#xA;ffmpeg_cmd = [&#xA;    "ffmpeg",&#xA;    "-re",&#xA;    "-f",&#xA;    "rawvideo",&#xA;    "-pix_fmt",&#xA;    "rgb24",&#xA;    "-s",&#xA;    f"{width}x{height}",&#xA;    "-i",&#xA;    "-",&#xA;    "-r",&#xA;    str(fps),&#xA;    "-avoid_negative_ts",&#xA;    "make_zero",&#xA;    "-vcodec",&#xA;    "libx264",&#xA;    "-threads",&#xA;    "4",&#xA;    "-f",&#xA;    "rtsp",&#xA;    rtsp_server_address,&#xA;]&#xA;colors = np.array(&#xA;    [&#xA;        [255, 0, 0],&#xA;        [0, 255, 0],&#xA;        [0, 0, 255],&#xA;    ]&#xA;).reshape(3, 1, 1, 3)&#xA;images = (np.ones((3, width, height, 3)) * colors).astype(np.uint8)&#xA;&#xA;if __name__ == "__main__":&#xA;&#xA;    process = subprocess.Popen(ffmpeg_cmd, stdin=subprocess.PIPE)&#xA;    start = time.time()&#xA;    exported = 0&#xA;    while True:&#xA;        exported &#x2B;= 1&#xA;        next_time = start &#x2B; exported / fps&#xA;        now = time.time()&#xA;        if next_time > now:&#xA;            sleep_dur = next_time - now&#xA;            time.sleep(sleep_dur)&#xA;&#xA;        image = images[exported % 3]&#xA;        image_bytes = image.tobytes()&#xA;&#xA;        process.stdin.write(image_bytes)&#xA;        process.stdin.flush()&#xA;&#xA;    process.stdin.close()&#xA;    process.wait()&#xA;

    &#xA;

    The issue is, that I need to run this at 10 fps because the processing step is heavy and can only afford 10 fps. Hence, as I reduce the frame rate from 25 to 10, the drop rate increases from 0% to 100%. And after a few iterations, I get a BrokenPipeError: [Errno 32] Broken pipe. Refer to the appendix for the complete log.

    &#xA;

    As an alternative, I can use OpenCV compiled from source with GStreamer [3], but I prefer using FFmpeg to make the shipping process simple. Since compiling OpenCV from source can be tedious and dependent on the system.

    &#xA;

    References

    &#xA;

    [1] Mediamtx (formerly rtsp-simple-server) : https://github.com/bluenviron/mediamtx

    &#xA;

    [2] FFmpeg : https://github.com/FFmpeg/FFmpeg

    &#xA;

    [3] Compile OpenCV with GStreamer : https://github.com/bluenviron/mediamtx?tab=readme-ov-file#opencv

    &#xA;

    Appendix

    &#xA;

    Creating the source stream

    &#xA;

    To instantiate the unprocessed stream, I use the following command. This streams the content of my webcam as and RTSP stream.

    &#xA;

    ffmpeg -video_size 1280x720 -i /dev/video0  -avoid_negative_ts make_zero -vcodec libx264 -r 10 -f rtsp rtsp://localhost:8554/webcam&#xA;

    &#xA;

    Error log

    &#xA;

    ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers&#xA;  built with gcc 12.3.0 (conda-forge gcc 12.3.0-5)&#xA;  configuration: --prefix=/home/conda/feedstock_root/build_artifacts/ffmpeg_1712656518955/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac --cc=/home/conda/feedstock_root/build_artifacts/ffmpeg_1712656518955/_build_env/bin/x86_64-conda-linux-gnu-cc --cxx=/home/conda/feedstock_root/build_artifacts/ffmpeg_1712656518955/_build_env/bin/x86_64-conda-linux-gnu-c&#x2B;&#x2B; --nm=/home/conda/feedstock_root/build_artifacts/ffmpeg_1712656518955/_build_env/bin/x86_64-conda-linux-gnu-nm --ar=/home/conda/feedstock_root/build_artifacts/ffmpeg_1712656518955/_build_env/bin/x86_64-conda-linux-gnu-ar --disable-doc --disable-openssl --enable-demuxer=dash --enable-hardcoded-tables --enable-libfreetype --enable-libharfbuzz --enable-libfontconfig --enable-libopenh264 --enable-libdav1d --enable-gnutls --enable-libmp3lame --enable-libvpx --enable-libass --enable-pthreads --enable-vaapi --enable-libopenvino --enable-gpl --enable-libx264 --enable-libx265 --enable-libaom --enable-libsvtav1 --enable-libxml2 --enable-pic --enable-shared --disable-static --enable-version3 --enable-zlib --enable-libopus --pkg-config=/home/conda/feedstock_root/build_artifacts/ffmpeg_1712656518955/_build_env/bin/pkg-config&#xA;  libavutil      58. 29.100 / 58. 29.100&#xA;  libavcodec     60. 31.102 / 60. 31.102&#xA;  libavformat    60. 16.100 / 60. 16.100&#xA;  libavdevice    60.  3.100 / 60.  3.100&#xA;  libavfilter     9. 12.100 /  9. 12.100&#xA;  libswscale      7.  5.100 /  7.  5.100&#xA;  libswresample   4. 12.100 /  4. 12.100&#xA;  libpostproc    57.  3.100 / 57.  3.100&#xA;Input #0, rawvideo, from &#x27;fd:&#x27;:&#xA;  Duration: N/A, start: 0.000000, bitrate: 184320 kb/s&#xA;  Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 640x480, 184320 kb/s, 25 tbr, 25 tbn&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))&#xA;[libx264 @ 0x5e2ef8b01340] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2&#xA;[libx264 @ 0x5e2ef8b01340] profile High 4:4:4 Predictive, level 2.2, 4:4:4, 8-bit&#xA;[libx264 @ 0x5e2ef8b01340] 264 - core 164 r3095 baee400 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - 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=4 threads=4 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=250 keyint_min=10 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&#xA;Output #0, rtsp, to &#x27;rtsp://localhost:8554/mystream&#x27;:&#xA;  Metadata:&#xA;    encoder         : Lavf60.16.100&#xA;  Stream #0:0: Video: h264, yuv444p(tv, progressive), 640x480, q=2-31, 10 fps, 90k tbn&#xA;    Metadata:&#xA;      encoder         : Lavc60.31.102 libx264&#xA;    Side data:&#xA;      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A&#xA;[vost#0:0/libx264 @ 0x5e2ef8b01080] Error submitting a packet to the muxer: Broken pipe   &#xA;[out#0/rtsp @ 0x5e2ef8afd780] Error muxing a packet&#xA;[out#0/rtsp @ 0x5e2ef8afd780] video:1kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown&#xA;frame=    1 fps=0.1 q=-1.0 Lsize=N/A time=00:00:04.70 bitrate=N/A dup=0 drop=70 speed=0.389x    &#xA;[libx264 @ 0x5e2ef8b01340] frame I:16    Avg QP: 6.00  size:   147&#xA;[libx264 @ 0x5e2ef8b01340] frame P:17    Avg QP: 9.94  size:   101&#xA;[libx264 @ 0x5e2ef8b01340] frame B:17    Avg QP: 9.94  size:    64&#xA;[libx264 @ 0x5e2ef8b01340] consecutive B-frames: 50.0%  0.0% 42.0%  8.0%&#xA;[libx264 @ 0x5e2ef8b01340] mb I  I16..4: 81.3% 18.7%  0.0%&#xA;[libx264 @ 0x5e2ef8b01340] mb P  I16..4: 52.9%  0.0%  0.0%  P16..4:  0.0%  0.0%  0.0%  0.0%  0.0%    skip:47.1%&#xA;[libx264 @ 0x5e2ef8b01340] mb B  I16..4:  0.0%  5.9%  0.0%  B16..8:  0.1%  0.0%  0.0%  direct: 0.0%  skip:94.0%  L0:56.2% L1:43.8% BI: 0.0%&#xA;[libx264 @ 0x5e2ef8b01340] 8x8 transform intra:15.4% inter:100.0%&#xA;[libx264 @ 0x5e2ef8b01340] coded y,u,v intra: 0.0% 0.0% 0.0% inter: 0.0% 0.0% 0.0%&#xA;[libx264 @ 0x5e2ef8b01340] i16 v,h,dc,p: 97%  0%  3%  0%&#xA;[libx264 @ 0x5e2ef8b01340] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  0%  0% 100%  0%  0%  0%  0%  0%  0%&#xA;[libx264 @ 0x5e2ef8b01340] Weighted P-Frames: Y:52.9% UV:52.9%&#xA;[libx264 @ 0x5e2ef8b01340] ref P L0: 88.9%  0.0%  0.0% 11.1%&#xA;[libx264 @ 0x5e2ef8b01340] kb/s:8.27&#xA;Conversion failed!&#xA;Traceback (most recent call last):&#xA;  File "/home/avishka/projects/read-process-stream/minimal-ffmpeg-error.py", line 58, in <module>&#xA;    process.stdin.write(image_bytes)&#xA;BrokenPipeError: [Errno 32] Broken pipe&#xA;</module>

    &#xA;