Recherche avancée

Médias (91)

Autres articles (85)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • Menus personnalisés

    14 novembre 2010, par

    MediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
    Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
    Menus créés à l’initialisation du site
    Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...)

Sur d’autres sites (7559)

  • av::av_encode_video produces blurred video from crisp files

    9 janvier 2023, par Abdirizak

    I am using the av::av_encode_video() function to produce a .mp4 video from png files, as in this answer. I pay special attention for the png files to be perfectly crisp, i.e. I plot matrices to png with exactly the same dimensions, so that every matrix cell maps to one cell in the png. Here is code to illustrate what I mean :

    


    library(av)

n.times <- 24*10
n.row <- 50
n.col <- 26

out.dir <- "/Users/Abdirizak/Documents/some/directory/"

for (i in 1:n.times) {
   
   current.mat <- matrix(data = rnorm(n.row*n.col), nrow = n.row, ncol = n.col)
   
   setwd(out.dir)
   png(filename = paste0(i, ".png"), width = n.row, height = n.col)
   
   par(mar = rep(0,4))
   image(current.mat)
   
   dev.off()
   
}

setwd(out.dir)
png.files <- paste0(out.dir, list.files(pattern = ".png$"))

av::av_encode_video(input = png.files, output = "000.mp4", framerate = 24)


    


    Now, even though my input .png files are perfectly crisp, the output .mp4 video is blurry. How can I prevent that from happening ? I.e. how can I get a perfectly crisp video ? (I am aware that this will likely inflate the file size of the .mp4 file)

    


    I already digged a bit into the vfilter argument of av_encode_video() and the underlying ffmpeg filter graphs on here, but could not yet really get the hang on it.

    


    I am looking at the .mp4 file through QuickTime Player on MacOS Ventura 13.0.1, and using R version 4.2.2 through RStudio 2022.12.0.353

    


    Edit 9.1.2023 :

    


    To further clarify, here is an example screenshot of a png image (not the original png file because that one appears too small here) :

    


    enter image description here

    


    As I said, a perfectly crisp image.

    


    On the other hand, a screenshot of the .mp4 movie looks like this :

    


    enter image description here

    


    Somewhat unsatisfactory. Any suggestions are welcome.

    


  • ffmpeg doesn't sometimes start reading RTSP stream from IP camera without error

    8 décembre 2022, par Petr Dub

    I've an IP camera, which provide RTSP stream. I want to read this stream, rotate it 90° and provide data for displaying video via IIS server. I have a working solution via ffmpeg, but it is not reliable. It ends after several minutes without error and it is not starting sometimes.

    


    I use this command :&#xA;ffmpeg.exe -thread_queue_size 128 -i "rtsp://<login>:<pwd>@192.168.0.201:554/live/ch0" -vf "transpose=1" -y -c:a aac -b:a 160000 -ac 1 -s 432x768 -g 50 -hls_time 2 -hls_list_size 1 -start_number 1 -hls_flags delete_segments m:\playlist.m3u8</pwd></login>

    &#xA;

    It works, but after several minutes (40 to 100) it stops without error (I have no idea why). When I restart the same ffmeg command, it sometimes doesn’t start reading the stream, but it doesn’t produce any error, the ffmpeg process is still running. Error output from ffmeg shows :

    &#xA;

    ffmpeg version 2022-11-03-git-5ccd4d3060-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers&#xA;  built with gcc 12.1.0 (Rev2, Built by MSYS2 project)&#xA;  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint&#xA;  libavutil      57. 40.100 / 57. 40.100&#xA;  libavcodec     59. 51.101 / 59. 51.101&#xA;  libavformat    59. 34.101 / 59. 34.101&#xA;  libavdevice    59.  8.101 / 59.  8.101&#xA;  libavfilter     8. 49.101 /  8. 49.101&#xA;  libswscale      6.  8.112 /  6.  8.112&#xA;  libswresample   4.  9.100 /  4.  9.100&#xA;  libpostproc    56.  7.100 / 56.  7.100&#xA;

    &#xA;

    The next row should be :

    &#xA;

    Input #0, rtsp, from &#x27;rtsp://<login>:<pwd>@192.168.0.201:554/live/ch0&#x27;</pwd></login>

    &#xA;

    Any ideas, what should I do ? At least to force ffmpeg end with error and not stays “running”…

    &#xA;

    Edit : I finally wrote a windows service, which starts the ffmpeg and monitors its error output. When nothing comes to this output for several seconds, it kills the ffmpeg process and starts a new one.

    &#xA;

  • How to overlay sequence of frames on video using ffmpeg-python ?

    19 novembre 2022, par Yogesh Yadav

    I tried below but it is only showing the background video.

    &#xA;

    background_video = ffmpeg.input( "input.mp4")&#xA;overlay_video = ffmpeg.input(f&#x27;{frames_folder}*.png&#x27;, pattern_type=&#x27;glob&#x27;, framerate=25)&#xA;subprocess = ffmpeg.overlay(&#xA;                          background_video,&#xA;                          overlay_video,&#xA;                        ).filter("setsar", sar=1)&#xA;

    &#xA;

    I also tried to assemble sequence of frames into .webm/.mov video but transparency is lost. video is taking black as background.

    &#xA;

    P.s - frame size is same as background video size. So no scaling needed.

    &#xA;

    Edit

    &#xA;

    I tried @Rotem suggestions

    &#xA;

    &#xA;

    Try using single PNG image first

    &#xA;

    &#xA;

    overlay_video =  ffmpeg.input(&#x27;test-frame.png&#x27;)&#xA;

    &#xA;

    It's not working for frames generated by OpenCV but working for any other png image. This is weird, when I'm manually viewing these frames folder it's showing blank images(Link to my frames folder).&#xA;But If I convert these frames into the video(see below) it is showing correctly what I draw on each frame.

    &#xA;

    output_options = {&#xA;                    &#x27;crf&#x27;: 20,&#xA;                    &#x27;preset&#x27;: &#x27;slower&#x27;,&#xA;                    &#x27;movflags&#x27;: &#x27;faststart&#x27;,&#xA;                    &#x27;pix_fmt&#x27;: &#x27;yuv420p&#x27;&#xA;                }&#xA;ffmpeg.input(f&#x27;{frames_folder}*.png&#x27;, pattern_type=&#x27;glob&#x27;, framerate=25 , reinit_filter=0).output(&#xA;                    &#x27;movie.avi&#x27;,&#xA;                    **output_options&#xA;                ).global_args(&#x27;-report&#x27;).run()&#xA;

    &#xA;

    &#xA;

    try creating a video from all the PNG images without overlay

    &#xA;

    &#xA;

    It's working as expected only issue is transparency. Is there is way to create a transparent background video ? I tried .webm/.mov/.avi but no luck.

    &#xA;

    &#xA;

    Add .global_args('-report') and check the log file

    &#xA;

    &#xA;

    Report written to "ffmpeg-20221119-110731.log"&#xA;Log level: 48&#xA;ffmpeg version 5.1 Copyright (c) 2000-2022 the FFmpeg developers&#xA;  built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)&#xA;  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon&#xA;  libavutil      57. 28.100 / 57. 28.100&#xA;  libavcodec     59. 37.100 / 59. 37.100&#xA;  libavformat    59. 27.100 / 59. 27.100&#xA;  libavdevice    59.  7.100 / 59.  7.100&#xA;  libavfilter     8. 44.100 /  8. 44.100&#xA;  libswscale      6.  7.100 /  6.  7.100&#xA;  libswresample   4.  7.100 /  4.  7.100&#xA;  libpostproc    56.  6.100 / 56.  6.100&#xA;Input #0, image2, from &#x27;./frames/*.png&#x27;:&#xA;  Duration: 00:00:05.00, start: 0.000000, bitrate: N/A&#xA;  Stream #0:0: Video: png, rgba(pc), 1920x1080, 25 fps, 25 tbr, 25 tbn&#xA;Codec AVOption crf (Select the quality for constant quality mode) specified for output file #0 (movie.avi) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.&#xA;Codec AVOption preset (Configuration preset) specified for output file #0 (movie.avi) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (png (native) -> mpeg4 (native))&#xA;Press [q] to stop, [?] for help&#xA;Output #0, avi, to &#x27;movie.avi&#x27;:&#xA;  Metadata:&#xA;    ISFT            : Lavf59.27.100&#xA;  Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p(tv, progressive), 1920x1080, q=2-31, 200 kb/s, 25 fps, 25 tbn&#xA;    Metadata:&#xA;      encoder         : Lavc59.37.100 mpeg4&#xA;    Side data:&#xA;      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A&#xA;frame=  125 fps= 85 q=31.0 Lsize=     491kB time=00:00:05.00 bitrate= 804.3kbits/s speed=3.39x    &#xA;video:482kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.772174%&#xA;

    &#xA;

    To draw frame I used below.

    &#xA;

    for i in range(num_frames):&#xA;            transparent_img = np.zeros((height, width, 4),  dtype=np.uint8)&#xA;            cv2.line(transparent_img, (x1,y1), (x2,y2) ,(255, 255, 255), thickness=1, lineType=cv2.LINE_AA)&#xA;            self.frames.append(transparent_img)&#xA;&#xA;&#xA;## To Save each frame of the video in the given folder&#xA;for i, f in enumerate(frames):&#xA;    cv2.imwrite("{}/{:0{n}d}.png".format(path_to_frames, i, n=num_digits), f)&#xA;&#xA;&#xA;&#xA;

    &#xA;