Recherche avancée

Médias (0)

Mot : - Tags -/organisation

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (82)

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

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

  • Récupération d’informations sur le site maître à l’installation d’une instance

    26 novembre 2010, par

    Utilité
    Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
    Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)

Sur d’autres sites (5662)

  • Piping OpenCV raw video frames into FFMpeg results in corrupted output

    27 novembre 2023, par Dudad

    I have written a python script to open my webcam in OpenCV and convert captured frames to video streams. I have followed some tutorials that basically do these things :

    


      

    1. Creating a pipe input to FFMpeg
    2. 


    3. Writing OpenCV video frames into the pipe. FFMpeg should then encode and output the video.
    4. 


    


    In my case, FFMpeg runs without errors, and using imshow() displays captured frames correctly, but the FFMpeg video output is corrupted.

    


    imshow()
video output

    


    code :

    


    import cv2 as cv
import subprocess as sp

FPS = 24
WIDTH = 720
HEIGHT = 360

cap = cv.VideoCapture(0)
cap.set(cv.CAP_PROP_FPS, FPS)
cap.set(cv.CAP_PROP_FRAME_WIDTH, WIDTH)
cap.set(cv.CAP_PROP_FRAME_HEIGHT, HEIGHT)

# ffmpeg command
ffmpeg_cmd = [
    "./libs/ffmpeg/bin/ffmpeg.exe",
    '-hwaccel', 'auto', '-y',
    '-f', 'rawvideo',
    '-vcodec','rawvideo',
    '-pix_fmt', 'bgr24',
    '-s', f"{WIDTH}x{HEIGHT}",
    '-r', str(FPS),
    '-i', '-',
    '-c:v', 'libx264',
    '-pix_fmt', 'yuv420p',
    '-preset', 'ultrafast',
    '-f', 'flv',
    'out.flv'
]
ffmpeg_sp = sp.Popen(ffmpeg_cmd, stdin=sp.PIPE)

while True:
    ret,frame = cap.read()
    # video capture test: OK
    cv.imshow('video', frame)
    if cv.waitKey(50)&0xFF == ord('q'):
        break
    #frame = cv.cvtColor(frame, cv.COLOR_BGR2YUV)   # It doesn't work
    # write to ffmpeg pipe
    ffmpeg_sp.stdin.write(frame.tobytes())

ffmpeg_sp.stdin.close()
cap.release()
cv.destroyAllWindows()


    


    I'm running Python 3.11.5, OpenCV 4.8.0.76 on Windows 11. The ffmpeg -version output is given below.

    


    ffmpeg version N-112841-g2d9ed64859-20231125 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 13.2.0 (crosstool-NG 1.25.0.232_c175b21)
configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libharfbuzz --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libaribcaption --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20231125
libavutil      58. 32.100 / 58. 32.100
libavcodec     60. 34.100 / 60. 34.100
libavformat    60. 17.100 / 60. 17.100
libavdevice    60.  4.100 / 60.  4.100
libavfilter     9. 13.100 /  9. 13.100
libswscale      7.  6.100 /  7.  6.100
libswresample   4. 13.100 /  4. 13.100
libpostproc    57.  4.100 / 57.  4.100


    


    I have been playing around with FFMpeg arguments for a while and none of them works. I have also transcoded video files using FFMpeg successfully. It somehow just doesn't work with raw video frames from OpenCV. Any help/advice is appreciated.

    


  • How can I combine a screenshot and two video files with ffmpeg ?

    26 novembre 2023, par lukascbossert

    I have a folder with video files. Some are .mov, some are .mp4. As a first step I am converting the .mov-files into .mp4 with :

    


    while read mov; do
   mp4=$(echo "$mov"|sed -e 's|\.mov$|.mp4|i')
   if [ "$mov" == "$mp4" ]; then
     echo "Failed to generate unique MP4 filename for file $mov"
   fi
   ffmpeg -i "$mov" -c:v libx264 -f mp4 "$mp4"
 done < <(find . -type f -iname '*.mov')


    


    This works technically fine.

    


    As a second step I need to merge two video files : the first one is always the same (intro.mp4 with audio), the second file is the either converted .mov or the .mp4 from the folder (also with audio).
Additionally I need a screenshot of the first frame from the second video, which shall be the very first frame and visible for e.g. half a second (for e.g. youtube-shorts to differentiate the videos).

    


    I create the screenshot with

    


    ffmpeg -i ${fzbVideo} -ss 1 -vframes 1 ${cover}"_%01d.jpg"


    


    which works perfectly fine.

    


    As far as I could I followed the example shown here and the documentation of ffmpeg
and created a loop for all the videos and the steps of merge screenshot and videos :

    


    for fzbVideo in *.mp4; do
    # intro should be at the beginning of each video
    intro="intro/fzb-intro.mp4"
    # getting a cover imge
    cover="$(basename ${fzbVideo} .mp4)_cover"
    # naming the output file
    fzbVideoOutput="$(basename ${fzbVideo} .mp4)_output.mp4"
    #   create a cover image from the first frame of the video
    ffmpeg -i ${fzbVideo} -ss 1 -vframes 1 ${cover}"_%01d.jpg"
    # combine the cover image with the intro and the actual video file
    ffmpeg \
-loop 1 -framerate 1 -t 1 -i ${cover}"_1.jpg" \
-i ${intro} \
-i ${fzbVideo} \
-f lavfi -t 0.1 -i anullsrc=channel_layout=stereo:sample_rate=44100 \
-filter_complex '[0:v:0][0:a:0][1:v:0][1:a:0][2:a:0][2:a:0]concat=n=3:v=1:a=1' ${fzbVideoOutput}
done


    


    But this creates the error :

    


    Stream specifier ':a:0' in filtergraph description [0:v:0][0:a:0][1:v:0][1:a:0][2:a:0][2:a:0]concat=n=3:v=1:a=1 matches no streams.


    


    What do I need to change ?
Additionally, is there a way to combine the converstion from .mov to .mp4 also in the loop (if necessary) ?

    



    


    Edit : content from the CLI, in case this is important information :

    


    ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers
  built with Apple clang version 14.0.3 (clang-1403.0.22.14.1)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/6.0_1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libsvtav1 --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-audiotoolbox --enable-neon
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
Input #0, image2, from 'IMG_5546_cover_1.jpg':
  Duration: 00:00:01.00, start: 0.000000, bitrate: 836 kb/s
  Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1080x1920, 1 fps, 1 tbr, 1 tbn
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'intro/fzb-intro.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: isommp41mp42
    creation_time   : 2023-11-24T21:59:10.000000Z
  Duration: 00:00:00.83, start: 0.000000, bitrate: 1247 kb/s
  Stream #1:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 602x1070, 1191 kb/s, 30 fps, 30 tbr, 600 tbn (default)
    Metadata:
      creation_time   : 2023-11-24T21:59:10.000000Z
      handler_name    : Core Media Video
      vendor_id       : [0][0][0][0]
  Stream #1:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 38 kb/s (default)
    Metadata:
      creation_time   : 2023-11-24T21:59:10.000000Z
      handler_name    : Core Media Audio
      vendor_id       : [0][0][0][0]
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'IMG_5546.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf60.3.100
  Duration: 00:00:28.37, start: 0.000000, bitrate: 3126 kb/s
  Stream #2:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1080x1920, 2989 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
    Metadata:
      handler_name    : Core Media Video
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.3.100 libx264
  Stream #2:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : Core Media Audio
      vendor_id       : [0][0][0][0]
Stream specifier ':a' in filtergraph description [0:v] [0:a] [1:v] [1:a] [2:v] [2:a] concat=n=3:v=1:a=1 [v] [a] matches no streams.


    


  • ffmpeg errors when playing a playlist - Non monotonous DTS

    20 novembre 2023, par Evilmachine

    i have a strange bug in ffmpeg. I am using ffmpeg to stream Twitch VODs and CLIPs to a 24/7 twitch channel. If i stream the files one by one its working. If i am streaming a playlist containing vods and clips i get this error when the shorter clips are playing :

    


    [flv @ 0x555677050c60] Non-monotonous DTS in output stream 0:0; previous: 56867, current: 31846; changing to 56867. This may result in incorrect timestamps in the output file.

    


    and the video stops. Once the playlist has a longer vod again it is working.

    


    here is my code that i use to stream :

    


    while [ 1 -eq 1 ]
do
ffmpeg  -fflags +igndts -re -f concat -safe 0 -i playlist.txt -codec copy -flvflags no_duration_filesize -f flv rtmp://XXXXXXXXX
done


    


    If i look into ffprobe the files seems both to be normal :

    


    VODs

    


    ffprobe version 5.1.3-1+rpt4 Copyright (c) 2007-2022 the FFmpeg developers
  built with gcc 12 (Debian 12.2.0-14)
  configuration: --prefix=/usr --extra-version=1+rpt4 --toolchain=hardened --incdir=/usr/include/aarch64-linux-gnu --enable-gpl --disable-stripping --disable-mmal --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sand --enable-sdl2 --disable-sndio --enable-libjxl --enable-neon --enable-v4l2-request --enable-libudev --enable-epoxy --libdir=/usr/lib/aarch64-linux-gnu --arch=arm64 --enable-pocketsphinx --enable-librsvg --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Speedrun - Goof Troop - Coop - @olli_wan und luk30994 -- Disney's Goof Troop.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2023-10-17T11:46:25.000000Z
  Duration: 00:28:23.02, start: 0.000000, bitrate: 1004 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 873 kb/s, 30 fps, 30 tbr, 15360 tbn (default)
    Metadata:
      creation_time   : 2023-10-17T11:46:25.000000Z
      handler_name    : ISO Media file produced by Google Inc. Created on: 10/17/2023.
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2023-10-17T11:46:25.000000Z
      handler_name    : ISO Media file produced by Google Inc. Created on: 10/17/2023.
      vendor_id       : [0][0][0][0]


    


    CLIPS

    


    ffprobe version 5.1.3-1+rpt4 Copyright (c) 2007-2022 the FFmpeg developers
  built with gcc 12 (Debian 12.2.0-14)
  configuration: --prefix=/usr --extra-version=1+rpt4 --toolchain=hardened --incdir=/usr/include/aarch64-linux-gnu --enable-gpl --disable-stripping --disable-mmal --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sand --enable-sdl2 --disable-sndio --enable-libjxl --enable-neon --enable-v4l2-request --enable-libudev --enable-epoxy --libdir=/usr/lib/aarch64-linux-gnu --arch=arm64 --enable-pocketsphinx --enable-librsvg --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Clip -- Luk - Terra - Lebensweisheiten mit Lukas Thema Smart.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.83.100
  Duration: 00:00:05.00, start: 0.000000, bitrate: 5520 kb/s
  Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, unknown/bt709/unknown, progressive), 1280x720, 5374 kb/s, 60.20 fps, 60 tbr, 15360 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]


    


    Has someone a hint why this error happens and how i can avoid them ?
Is gstreamer better for this approach ?

    


    Thanks a lot in Advance.

    


    I tried changing the files.