
Recherche avancée
Autres articles (64)
-
Gestion des droits de création et d’édition des objets
8 février 2011, parPar défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;
-
Dépôt de média et thèmes par FTP
31 mai 2013, parL’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...) -
Keeping control of your media in your hands
13 avril 2011, parThe vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)
Sur d’autres sites (8055)
-
Evolution #2941 (Fermé) : RSS enclosure et media:content
1er mars 2013, par marcimat -Fermé par
r20221 et report r20225
http://zone.spip.org/trac/spip-zone/changeset/70316 et report http://zone.spip.org/trac/spip-zone/changeset/70317 Merci :)
-
fftools/ffmpeg : store stream media type in OutputStream
11 avril 2023, par Anton Khirnovfftools/ffmpeg : store stream media type in OutputStream
Reduces access to a deeply nested muxer property
OutputStream.st->codecpar->codec_type for this fundamental and immutable
stream property.Besides making the code shorter, this will allow making the AVStream
(OutputStream.st) private to the muxer in the future. -
Python OpenCV VideoCapture Color Differs from ffmpeg and Other Media Players
17 avril 2024, par cliffsuI’m working on video processing in Python and have noticed a slight color difference when using
cv2.VideoCapture
to read videos compared to other media players.



I then attempted to read the video frames directly using ffmpeg, and despite using the ffmpeg backend in OpenCV, there are still differences between OpenCV’s and ffmpeg’s output. The frames read by ffmpeg match those from other media players.




Below are the videos I’m using for testing :






Here is my code :


import cv2
import numpy as np
import subprocess

def read_frames(path, res):
 """Read numpy arrays of video frames. Path is the file path
 and res is the resolution as a tuple."""
 args = [
 "ffmpeg",
 "-i",
 path,
 "-f",
 "image2pipe",
 "-pix_fmt",
 "rgb24",
 "-vcodec",
 "rawvideo",
 "-",
 ]

 pipe = subprocess.Popen(
 args,
 stdout=subprocess.PIPE,
 stderr=subprocess.DEVNULL,
 bufsize=res[0] * res[1] * 3,
 )

 while pipe.poll() is None:
 frame = pipe.stdout.read(res[0] * res[1] * 3)
 if len(frame) > 0:
 array = np.frombuffer(frame, dtype="uint8")
 break

 pipe.stdout.close()
 pipe.wait()
 array = array.reshape((res[1], res[0], 3))
 array = cv2.cvtColor(array, cv2.COLOR_RGB2BGR)
 return array

ORIGINAL_VIDEO = 'test3.webm'

array = read_frames(ORIGINAL_VIDEO, (1280, 720))

cap = cv2.VideoCapture(ORIGINAL_VIDEO, cv2.CAP_FFMPEG)
while cap.isOpened():
 ret, frame = cap.read()
 if not ret:
 break
 print(frame.shape)
 cv2.imshow("Opencv Read", frame)
 cv2.imshow("FFmpeg Direct Read", array)
 cv2.waitKeyEx()
 cv2.waitKeyEx()
 break
cap.release()



I’ve attempted to use different media players to compare
cv2.VideoCapture
and ffmpeg’s frame reading, to confirm that the issue lies with opencv. I’m looking to determine whether it’s a bug in OpenCV or if there are issues in my code.

EDIT :


Just use the following code to check the difference between opencv read and ffmpeg read.


cv2.imshow('test', cv2.absdiff(array, frame)*10)
cv2.waitKey(0)