Recherche avancée

Médias (3)

Mot : - Tags -/spip

Autres articles (35)

  • Librairies et binaires spécifiques au traitement vidéo et sonore

    31 janvier 2010, par

    Les logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
    Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
    Binaires complémentaires et facultatifs flvtool2 : (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

Sur d’autres sites (6449)

  • ffmpeg batch frame extraction to .png

    21 juillet 2022, par Samuel Lang

    I'm attempting to extract stacks of .png files from short 20-second videos of zebrafish hearts for ImageJ heartbeat analysis.

    


    So far, this code,

    


    ffmpeg -i C:\example_directory\filename.movS -r 30/1 C:\example_directory\filename_%04d.png


    


    works quite well. However, this can only be run for one video file at a time, and outputs to one folder at a time.

    


    I have a bit of code that converts multiple .mp4 videos into .mov :

    


    for i in *.mp4; do ffmpeg -i "$i" -qscale 0 "$(basename"$i" .mp4)".mov ; done


    


    is there a way to use a for loop or some kind of batch or .sh file to automate the .png extraction from a large group of short videos, say, a twenty or so videos ?

    


    I'm trying to write instructions to streamline the video and image processing for future lab students, so it might be helpful to know if there are differences in automating this for macOS, linux, or Windows 10

    


    any advice is welcome !

    


    thanks

    


  • FFMPEG Video Corrupt When Not Perfect Square

    23 avril 2022, par Bigbob556677

    I am writing frames from OpenCV using the following method. These code works totally fine when using a perfectly square resolution like 1000x1000 or 500x500, but when trying to do 1920x1200 or any other rectangular resolution, the written MP4 contains what is seen in the attached image. The MP4 file plays that still frame for the exact number of excepted seconds.

    


    What could possibly be causing this kind of behavior ?

    


      

    • The camera width and height match the output resolution
    • 


    • What is seen in the attachment is actually a frame from the camera, its just corrupted in the way seen.
    • 


    • File size matches excpected output roughly
    • 


    


    process = sp.Popen(shlex.split(f'ffmpeg -y -hide_banner -loglevel error
 -s {fwidth}x{fheight} -pixel_format bgr24 -f rawvideo 
-r {self.fps} -i pipe: -vcodec libx265 -pix_fmt yuv420p 
-crf 24 {filename}'), stdin=sp.PIPE)

for frame in frameList:
    process.stdin.write(frame.tobytes())

# Close and flush stdin
process.stdin.close()

# Wait for sub-process to finish
process.wait()

# Terminate the sub-process
process.terminate()


    


    enter image description here

    


    Attached is the ffprobe log

    


    ffprobe version 3.4.8-0ubuntu0.2 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/html/students/RH-PITCH_VIDEO.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf57.83.100
  Duration: 00:00:03.13, start: 0.000000, bitrate: 452 kb/s
    Stream #0:0(und): Video: hevc (Main) (hev1 / 0x31766568), yuv420p(tv, progressive), 1200x1100, 432 kb/s, 160 fps, 160 tbr, 10240 tbn, 160 tbc (default)
    Metadata:
      handler_name    : VideoHandler


    


  • Concatenating audio files and superimposing over video

    25 avril 2022, par kah

    I'm trying to write a program that takes a bunch of videos from a folder, compiles them, and then takes another bunch of audio files from a folder and concatenates them to then overlay the combined audio on top of the final video (hope that makes sense). I'm able to process the videos into one final output video, but I keep running into trouble combining the audio. Below I've provided two small sections of code pertaining to audio comp, I'm using moviepy to process the videos and attempting to use it for audio as well.

    


    songDirectory = './songs/'
songList = []
songs = []
audioclip=''

def makeCompilation():
    for filename in os.listdir(songDirectory):
        f = os.path.join(songDirectory, filename)
        if os.path.isfile(f) and filename.endswith(".mp3"):
            audioclip = moviepy.editor.AudioFileClip(f)
            songList.append(filename)


    for song in os.listdir(songDirectory):
        c = os.path.join(songDirectory, song)
    audio_clips = moviepy.editor.AudioFileClip(c)
    audio_output = moviepy.editor.concatenate_audioclips(audio_clips)
    finalClip = concatenate_videoclips(videos, method="compose")
    final_duration = finalClip.duration    
    final_audio_output = audio_output.set_duration(final_duration)
    final_output= finalClip.set_audio(final_audio_output).fx(afx.audio_fadein, 3.0)


    audio_path = "./songs/tempaudiofile.m4a"

    #print(description)
    # Create compilation
    final_output.write_videofile(outputFile, threads=8, temp_audiofile=audio_path, remove_temp=True, codec="libx264", audio_codec="aac")

    return description


    


    The program appeared to be able to find the audio directory, but I needed to be able to use os.path.join(songDirectory, filename) to point directly to each mp3 file so I messed around with it until I got the above code. And when I attempted to iterate through songList, I, as expected, got an error saying that 'str' wasn't iterable, and other errors saying that 'str' has no attribute 'duration'. Essentially, all I need it to do is iterate though the input folder and combine the files by whatever means. Code currently returns the output :

    


    &#127794;Free Fredobagz x Aflacko x Flint type beat - &#x27;Default_Dance&#x27; [prod. kah]-jro0v6ogZ0Y.mp4&#xA;225.05&#xA;Total Length: 225.05&#xA;225.05&#xA;Traceback (most recent call last):&#xA;  File "/Users/daddyK/Desktop/comp_ bot/make_compilation3.py", line 127, in <module>&#xA;makeCompilation(path = "./videos/",&#xA;  File "/Users/daddyK/Desktop/comp_ bot/make_compilation3.py", line 110, in makeCompilation&#xA;audio_output = moviepy.editor.concatenate_audioclips(audio_clips)&#xA;  File "/Users/daddyK/Library/Python/3.10/lib/python/site-packages/moviepy/audio/AudioClip.py", line 315, in concatenate_audioclips&#xA;durations = [c.duration for c in clips]&#xA;TypeError: &#x27;AudioFileClip&#x27; object is not iterable&#xA;</module>

    &#xA;


    &#xA;

    At this point I'm a bit stumped, so if anybody could offer some insight as to what I should do to resolve the error and/or if I'm headed in the right direction code-wise I'd greatly appreciate it ! Sorry if the code doesn't make any sense I'll post the whole .py file if needed

    &#xA;