Recherche avancée

Médias (91)

Autres articles (73)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

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

Sur d’autres sites (11542)

  • mp4 video written with ffmpeg has different first frame based on total number of frames

    25 janvier 2023, par Nitzan Weissman

    I have a code that writes and reads videos in Python, I'm doing the writing using ffmpeg. I noticed a weird phenomenon, where the first frame changes based on the total number of frames in the video. I find it weird because the first frame is a key frame (I checked it using ffprobe)

    


    The code I'm using :

    


    The writing function

    


    import shutil
import subprocess
def write_h264_video(video_path: str, images: np.ndarray, fps: float):
    image_name_template = '00%04d.png'
    tmp_image_dir = (Path(video_path).parent / 'tmp_imgs')
    tmp_image_dir.mkdir()

    for ii, image in enumerate(images):
        cv2.imwrite(f'{str(tmp_image_dir / str(ii).zfill(6))}.png', image[..., ::-1])    
    command = f'ffmpeg -hide_banner -loglevel error -framerate {fps} -y -i {tmp_image_dir}/{image_name_template} ' \
            f' -c:v libx264 -pix_fmt yuv420p {video_path} -y'
    subprocess.call(command, shell=True)
    shutil.rmtree(tmp_image_dir)


    


    The main code

    


    import numpy as np
from pathlib import Path
import decord
decord.bridge.set_bridge('torch')

input_video_path = Path('')
tmp_path = Path('')
input_video = decord.VideoReader(str(input_video_path))

frames = np.zeros((20, 512, 512, 3), dtype = np.uint8)
for i in range(20):
    frames[i] = input_video[i].detach().cpu().numpy()
    
long_video_path = tmp_path / 'long_video.mp4'
short_video_path = tmp_path / 'short_video.mp4'

fps = 30
write_h264_video(str(long_video_path), frames, fps=fps)
write_h264_video(str(short_video_path), frames[:10], fps=fps)


long_video = decord.VideoReader(str(long_video_path))
short_video = decord.VideoReader(str(short_video_path))

long_frame_0 = long_video[0]
short_frame_0 = short_video[0]
(long_frame_0 == short_frame_0).all()


    


    I am supposed to get True, but I'm getting False.
I tried reading using other methods, using opencv for example, and the issue persists.
There are other ways to write videos of course, but I'm interested in ffmpeg-based ways.

    


    Thanks !

    


  • What is the most efficient way to trim and join multiple videos in ffmpeg ?

    27 avril 2020, par Patrick Oshea

    I have a python program that downloads a bunch of .mp4 videos into a directory for me and after running a few audio matching algorithms I need to trim the videos to a minute and eventually concantenate them all together.

    



    As of right now I do the following things to a video :
Trim it to a minute
Resize the videos so they're all the same size
Apply a picture to the video
And then pad the video (this is due to a weird glitch that occurs if I try joining all the videos together which results in the audio and video not being synched)

    



    Is there any way to combine some of the steps or things I should make sure I'm doing to do this as fast as possible ? Thank you in advance !

    


  • mov : Export geotag metadata fields

    3 juin 2014, par Martin Storsjö
    mov : Export geotag metadata fields
    

    The ’ ?xyz’ form is used by android devices (and according to apple
    mailing list archives, also by older iOS devices). The ’loci’ field
    (defined in 3GPP 26.244) is used by recent iOS devices.

    Even though the loci field can contain an altitude, it was plain
    0 in my sample. Just export longitude and latitude, in a string
    format matching the one used by the ’ ?xyz’ metadata field.

    Signed-off-by : Martin Storsjö <martin@martin.st>

    • [DBH] libavformat/mov.c