
Recherche avancée
Autres articles (35)
-
MediaSPIP v0.2
21 juin 2013, parMediaSPIP 0.2 est la première version de MediaSPIP stable.
Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Comme pour la version précédente, 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 (...) -
Mise à disposition des fichiers
14 avril 2011, parPar défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...) -
MediaSPIP version 0.1 Beta
16 avril 2011, parMediaSPIP 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 (...)
Sur d’autres sites (4628)
-
Révision 18411 : Quand on arrive sur la page des plugins, faire en sorte que le menu soit synchro...
31 août 2011, par cedric -Pour cela on passe le md5 des menus en parametre de la css privee. De plus, les menus sont definis dans un fichier fonctions chargé avant l’actualisation des plugins (les fichiers sont chargés par SAX dans tous les cas, donc pour lire le paquet.xml). On prévoit donc un define qui permet de les (...)
-
Django api returns Gif as JPG despite a function to add it as video
7 septembre 2023, par EarthlingI'm trying to upload a .gif to my django 3.2 api. I have already ran troubleshoots through Postman and came to the conclusion that my flutter app sends it as a .gif and it gets returned as a .jpg. The problem is on the backend. Here is my relevant code which checks for file_meme subtype and then the function should convert the incoming .gif to a video :




def add_media(self, file, order=None):
 check_can_add_media(post=self)

 is_in_memory_file = isinstance(file, InMemoryUploadedFile) or isinstance(file, SimpleUploadedFile)

 if is_in_memory_file:
 file_mime = magic.from_buffer(file.read())
 elif isinstance(file, TemporaryUploadedFile):
 file_mime = magic.from_file(file.temporary_file_path())
 else:
 file_mime = magic.from_file(file.name)

 check_mimetype_is_supported_media_mimetypes(file_mime)
 # Mime check moved pointer
 file.seek(0)

 file_mime_types = file_mime.split('/')

 file_mime_type = file_mime_types[0]
 file_mime_subtype = file_mime_types[1]

 temp_files_to_close = []

 if file_mime_subtype == 'gif':
 if is_in_memory_file:
 file = write_in_memory_file_to_disk(file)

 temp_dir = tempfile.gettempdir()
 converted_gif_file_name = os.path.join(temp_dir, str(uuid.uuid4()) + '.mp4')

 ff = ffmpy.FFmpeg(
 inputs={file.temporary_file_path() if hasattr(file, 'temporary_file_path') else file.name: None},
 outputs={converted_gif_file_name: None})
 ff.run()
 converted_gif_file = open(converted_gif_file_name, 'rb')
 temp_files_to_close.append(converted_gif_file)
 file = File(file=converted_gif_file)
 file_mime_type = 'video'

 has_other_media = self.media.exists()
 
 if file_mime_type == 'image':
 post_image = self._add_media_image(image=file, order=order)
 if not has_other_media:
 self.media_width = post_image.width
 self.media_height = post_image.height
 self.media_thumbnail = file

 elif file_mime_type == 'video':
 post_video = self._add_media_video(video=file, order=order)
 if not has_other_media:
 self.media_width = post_video.width
 self.media_height = post_video.height
 self.media_thumbnail = post_video.thumbnail.file
 else:
 raise ValidationError(
 _('Unsupported media file type')
 )

 for file_to_close in temp_files_to_close:
 file_to_close.close()
 
 
 self.save()







def _add_media_image(self, image, order):
 return PostImage.create_post_media_image(image=image, post_id=self.pk, order=order)

def _add_media_video(self, video, order):
 return PostVideo.create_post_media_video(file=video, post_id=self.pk, order=order)


@classmethod
 def create_post_media_image(cls, image, post_id, order):
 hash = sha256sum(file=image.file)
 post_image = cls.objects.create(image=image, post_id=post_id, hash=hash, thumbnail=image)
 PostMedia.create_post_media(type=PostMedia.MEDIA_TYPE_IMAGE,
 content_object=post_image,
 post_id=post_id, order=order)
 return post_image


@classmethod
 def create_post_media_video(cls, file, post_id, order):
 hash = sha256sum(file=file.file)
 video_backend = get_backend()

 if isinstance(file, InMemoryUploadedFile):
 # If its in memory, doing read shouldn't be an issue as the file should be small.
 in_disk_file = write_in_memory_file_to_disk(file)
 thumbnail_path = video_backend.get_thumbnail(video_path=in_disk_file.name, at_time=0.0)
 else:
 thumbnail_path = video_backend.get_thumbnail(video_path=file.file.name, at_time=0.0)

 with open(thumbnail_path, 'rb+') as thumbnail_file:
 post_video = cls.objects.create(file=file, post_id=post_id, hash=hash, thumbnail=File(thumbnail_file), )
 PostMedia.create_post_media(type=PostMedia.MEDIA_TYPE_VIDEO,
 content_object=post_video,
 post_id=post_id, order=order)
 return post_video
 
 



I'm not sure where the problem is. From my limited understanding, it is taking only the first frame of the .gif and uploading it as an image.


-
Python & OpenCV - VideoCapture.read() always returns false
21 août 2017, par JulenI need to extract frames from a video at a given time, and I’m using OpenCV for it. I’m using Linux Mint 18.1, but it must also run on Ubuntu.
This code example is not working for me :
import cv2
print('making screenshot from {0}'.format('/tmp/big_buck_bunny_720p_5mb.mp4'))
cap = cv2.VideoCapture(video_path)
cap.set(cv2.CAP_PROP_POS_MSEC,1000)
ret,frame = cap.read()
print(ret) # This is false
cv2.imwrite("image.jpg", frame) # Creates an empty file(I’ve checked that the path of the video is correct and that the file is not corrupted).
I have installed the Python OpenCV 3.3.0 version :
>>> import cv2
>>> cv2.__version__
'3.3.0'I’ve compiled and installed the source for OpenCV (with the
WITH_FFMPEG=ON
option) :git clone https://github.com/Itseez/opencv.git /tmp/opencv-3
/tmp/opencv-3
mkdir -p release
cd release
cmake -D WITH_FFMPEG=ON -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make installThe output of
ffmpeg -version
is the following :ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --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-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --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-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100What am I missing ?