Recherche avancée

Médias (91)

Autres articles (85)

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

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

Sur d’autres sites (6393)

  • How to convert mkv to mp4 in ffmpeg losslessly

    16 novembre 2022, par crsswrdz

    I'm trying to losslessly convert an .mkv to .mp4.
(For use in Premiere Pro for film analysis and teaching).

    


    When I do so, I get a noticeable drop in file size (11gb to 2gb) and image quality.
The 5.1 streams are maintained but lose their mapping (everything seems displaced i.e. center channel now in the right channel) and the subtitles are lost.

    


    Is it possible to losslessly remux this .mkv to .mp4 ?
I don't want to re-encode it.

    


    E:\>ffmpeg -i Dune.mkv Dune.mp4
ffmpeg version 2022-11-03-git-5ccd4d3060-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.1.0 (Rev2, Built by MSYS2 project)
  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
  libavutil      57. 40.100 / 57. 40.100
  libavcodec     59. 51.101 / 59. 51.101
  libavformat    59. 34.101 / 59. 34.101
  libavdevice    59.  8.101 / 59.  8.101
  libavfilter     8. 49.101 /  8. 49.101
  libswscale      6.  8.112 /  6.  8.112
  libswresample   4.  9.100 /  4.  9.100
  libpostproc    56.  7.100 / 56.  7.100
Input #0, matroska,webm, from 'Dune.mkv':
  Metadata:
    title           : Dune
    encoder         : libebml v1.4.2 + libmatroska v1.6.4
    creation_time   : 2021-10-17T11:10:41.000000Z
  Duration: 02:28:56.16, start: 0.000000, bitrate: 10192 kb/s
  Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x776, SAR 1:1 DAR 240:97, 25 fps, 25 tbr, 1k tbn (default)
    Metadata:
      BPS             : 9806853
      DURATION        : 02:28:56.160000000
      NUMBER_OF_FRAMES: 223404
      NUMBER_OF_BYTES : 10954451639
      _STATISTICS_WRITING_APP: mkvmerge v62.0.0.1 ('Apollo') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2021-10-17 11:10:41
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s (default)
    Metadata:
      BPS             : 384000
      DURATION        : 02:28:56.128000000
      NUMBER_OF_FRAMES: 279254
      NUMBER_OF_BYTES : 428934144
      _STATISTICS_WRITING_APP: mkvmerge v62.0.0.1 ('Apollo') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2021-10-17 11:10:41
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:2(eng): Subtitle: subrip (forced)
    Metadata:
      title           : FORCED
      BPS             : 1
      DURATION        : 01:49:04.860000000
      NUMBER_OF_FRAMES: 43
      NUMBER_OF_BYTES : 1104
      _STATISTICS_WRITING_APP: mkvmerge v62.0.0.1 ('Apollo') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2021-10-17 11:10:41
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:3(eng): Subtitle: subrip (default)
    Metadata:
      BPS             : 34
      DURATION        : 02:20:49.064000000
      NUMBER_OF_FRAMES: 998
      NUMBER_OF_BYTES : 36676
      _STATISTICS_WRITING_APP: mkvmerge v62.0.0.1 ('Apollo') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2021-10-17 11:10:41
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (ac3 (native) -> aac (native))
Press [q] to stop, [?] for help
[aac @ 0000016e39c4a7c0] Using a PCE to encode channel layout "5.1(side)"
[libx264 @ 0000016e396ded40] using SAR=1/1
[libx264 @ 0000016e396ded40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0000016e396ded40] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 0000016e396ded40] 264 - core 164 r3101 b093bbe - 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=-2 threads=24 lookahead_threads=4 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=25 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
Output #0, mp4, to 'Dune.mp4':
  Metadata:
    title           : Dune
    encoder         : Lavf59.34.101
  Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x776 [SAR 1:1 DAR 240:97], q=2-31, 25 fps, 12800 tbn (default)
    Metadata:
      BPS             : 9806853
      DURATION        : 02:28:56.160000000
      NUMBER_OF_FRAMES: 223404
      NUMBER_OF_BYTES : 10954451639
      _STATISTICS_WRITING_APP: mkvmerge v62.0.0.1 ('Apollo') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2021-10-17 11:10:41
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      encoder         : Lavc59.51.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
  Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1(side), fltp, 394 kb/s (default)
    Metadata:
      BPS             : 384000
      DURATION        : 02:28:56.128000000
      NUMBER_OF_FRAMES: 279254
      NUMBER_OF_BYTES : 428934144
      _STATISTICS_WRITING_APP: mkvmerge v62.0.0.1 ('Apollo') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2021-10-17 11:10:41
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      encoder         : Lavc59.51.101 aac
frame=115222 fps=216 q=28.0 00000000000000000000000004009000size= 1180416kB time=01:16:52.41 bitrate=2096.5kbits/s speed=8.65x



    


  • Stream RAW8 video from camera using openCV and Python [Windows]

    14 novembre 2022, par awin

    We have a camera that streams RAW8 video at 1920x1080. The GUID used is GREY. We are able to stream video from this camera using ffmpeg on Windows with the below command :

    


    ffmpeg -f dshow -pix_fmt gray -video_size 1920x1080 -i video="CAM0" -f nut - | ffplay -


    


    We are now trying to grab images from this camera using OpenCV using the below code snippet, but its unable to grab any frame (frame_grabbed is always false)

    


    import cv2
import numpy as np

# reading the video from CAM0
source = cv2.VideoCapture(1)

height = 1920
width = 1080

source.set(cv2.CAP_PROP_FRAME_WIDTH, width)
source.set(cv2.CAP_PROP_FRAME_HEIGHT, height)


image = np.zeros([height, width, 3], np.uint8)

while True:
    # Extracting the frames
    frame_grabbed , image = source.read()

    if (frame_grabbed ):
        colour1 = cv2.cvtColor(image, cv2.COLOR_BayerRG2BGR)
        cv2.imshow("Demosaiced image", colour1)
    else:
        print("No images grabbed")

#Exit on q
    key = cv2.waitKey(1)
    if key == ord("q"):
       break

# closing the window
cv2.destroyAllWindows()
source.release()



    


    Are we missing something here ?

    


    We then came across this post to pipe ffmpeg output to python (link). However, when we are passing the command as below :

    


    command = [ 'ffmpeg.exe',
            '-f', 'dshow',
            '-i', 'video="CAM0"',
            '-pix_fmt', 'gray',
            '-video_size','1920x1080'
            '-f', 'nut', '-']


    


    its throwing

    


    


    Could not find video device with name ["CAM0"] among source devices
of type video. video="CAM0" : I/O error

    


    


    I have verified that the camera is present using the below command :

    


    command = [ 'ffmpeg.exe',
            '-list_devices', 'true',
            '-f', 'dshow',
            '-i', 'dummy']


    


    This detects CAM0 as shown below :

    


    ffmpeg version 5.0.1-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 11.2.0 (Rev7, Built by MSYS2 project)
  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-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --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-libmfx --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
  libavutil      57. 17.100 / 57. 17.100
  libavcodec     59. 18.100 / 59. 18.100
  libavformat    59. 16.100 / 59. 16.100
  libavdevice    59.  4.100 / 59.  4.100
  libavfilter     8. 24.100 /  8. 24.100
  libswscale      6.  4.100 /  6.  4.100
  libswresample   4.  3.100 /  4.  3.100
  libpostproc    56.  3.100 / 56.  3.100
[dshow @ 000001ea39e40600] "HP HD Camera" (video)
[dshow @ 000001ea39e40600]   Alternative name "@device_pnp_\\?\usb#vid_04f2&pid_b6bf&mi_00#6&1737142c&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global"
[dshow @ 000001ea39e40600] "CAM0" (video)
[dshow @ 000001ea39e40600]   Alternative name "@device_pnp_\\?\usb#vid_0400&pid_0011&mi_00#7&1affbd5b&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global"


    


    In short, we are able to capture video using ffmpeg commandline, but unable to grab any frame using OpenCV videocapture or ffmpeg in opencv. Any pointers ?

    


    Thanks !

    


  • Combining png and mp3, why using -loop 1 on image and -shortest tag doesn't cut the output length when audio ends ?

    9 novembre 2022, par Alexander

    I have several image and audio files and I want to combine each of the set to a separate video file where image is stretched to audio file length. For example a lion image should be displayed as long as the lion voice is being played. The output file should end when lion audio ends.

    


    I also try to normalize output clips resolution since image files doesn't have same width/height.

    


    Here is the command I'm currently running. Command is on one line but I made some line breaks here for your convenience.

    


    -loop 1 
-i "C:\Temp\screenshot\clip_1.png"
-i "C:\Temp\audio\clip_1.mp3" 
-shortest 
-filter_complex "[0:v]scale=3000:-2:force_original_aspect_ratio=decrease" 
-c:v h264_nvenc 
-c:a aac 
-b:a 192k 
-y 
C:\Temp\clips\clip_1.mp4


    


    To my understanding the -loop 1 before image input should make it to loop infinite and -shortest should end the video when shortest input (audio in this case) ends. In following example, the audio file is 6 seconds long but the output is always 20 seconds.

    


    Here is the full output of ffmpeg :

    


    ffmpeg version 2022-11-03-git-5ccd4d3060-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.1.0 (Rev2, Built by MSYS2 project)
  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 --enabl
e-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 --ena
ble-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 --e
nable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      57. 40.100 / 57. 40.100
  libavcodec     59. 51.101 / 59. 51.101
  libavformat    59. 34.101 / 59. 34.101
  libavdevice    59.  8.101 / 59.  8.101
  libavfilter     8. 49.101 /  8. 49.101
  libswscale      6.  8.112 /  6.  8.112
  libswresample   4.  9.100 /  4.  9.100
  libpostproc    56.  7.100 / 56.  7.100
Input #0, png_pipe, from 'C:\Temp\screenshot\clip_1.png':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: png, rgba(pc), 640x148, 25 fps, 25 tbr, 25 tbn
[mp3 @ 0000016c26784a80] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from 'C:\Temp\audio\clip_1.mp3':
  Duration: 00:00:06.10, start: 0.000000, bitrate: 32 kb/s
  Stream #1:0: Audio: mp3, 24000 Hz, mono, fltp, 32 kb/s
Stream mapping:
  Stream #0:0 (png) -> scale:default (graph 0)
  scale:default (graph 0) -> Stream #0:0 (h264_nvenc)
  Stream #1:0 -> #0:1 (mp3 (mp3float) -> aac (native))
Press [q] to stop, [?] for help
[aac @ 0000016c267ab180] Too many bits 8192.000000 > 6144 per frame requested, clamping to max
Output #0, mp4, to 'C:\Temp\clips\clip_1.mp4':
  Metadata:
    encoder         : Lavf59.34.101
  Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661), rgba(pc, gbr/unknown/unknown, progressive), 3000x694, q=2-31, 2000 kb/s, 25 fps, 12800 tbn
    Metadata:
      encoder         : Lavc59.51.101 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: N/A
  Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 24000 Hz, mono, fltp, 144 kb/s
    Metadata:
      encoder         : Lavc59.51.101 aac
frame=  504 fps=149 q=11.0 Lsize=     925kB time=00:00:20.00 bitrate= 378.8kbits/s speed=5.91x
video:852kB audio:67kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.645776%
[aac @ 0000016c267ab180] Qavg: 65496.695