Recherche avancée

Médias (16)

Mot : - Tags -/mp3

Autres articles (30)

  • D’autres logiciels intéressants

    12 avril 2011, par

    On ne revendique pas d’être les seuls à faire ce que l’on fait ... et on ne revendique surtout pas d’être les meilleurs non plus ... Ce que l’on fait, on essaie juste de le faire bien, et de mieux en mieux...
    La liste suivante correspond à des logiciels qui tendent peu ou prou à faire comme MediaSPIP ou que MediaSPIP tente peu ou prou à faire pareil, peu importe ...
    On ne les connais pas, on ne les a pas essayé, mais vous pouvez peut être y jeter un coup d’oeil.
    Videopress
    Site Internet : (...)

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

  • Création définitive du canal

    12 mars 2010, par

    Lorsque votre demande est validée, vous pouvez alors procéder à la création proprement dite du canal. Chaque canal est un site à part entière placé sous votre responsabilité. Les administrateurs de la plateforme n’y ont aucun accès.
    A la validation, vous recevez un email vous invitant donc à créer votre canal.
    Pour ce faire il vous suffit de vous rendre à son adresse, dans notre exemple "http://votre_sous_domaine.mediaspip.net".
    A ce moment là un mot de passe vous est demandé, il vous suffit d’y (...)

Sur d’autres sites (4782)

  • Django api returns Gif as JPG despite a function to add it as video

    7 septembre 2023, par Earthling

    I'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.

    


  • How do I combine PyTube audio and video streams in a Flask app and let the user download as one file without storing on the web server ?

    10 avril 2022, par AJB9384

    I'm building a YouTube downloader as a side project in Flask. It allows users to input a url and download the video without storing anything on the server I'm hosting on

    


    Lower quality videos can be sent to the user easily as they from PyTube as one file. I use the code below :

    


    import os
import flask
from flask import redirect, url_for, session, send_file
import requests

import pytube
from pytube import YouTube
from io import BytesIO

@app.route('/pull_videos', methods = ['GET', 'POST'])
def pull_videos(): 
  buffer=BytesIO()
  yt_test=YouTube('https://www.youtube.com/watch?v=NNNPgIfK2YE')
  video = yt_test.streams.get_by_itag(251)

  video.stream_to_buffer(buffer)
  buffer.seek(0)

  return send_file(buffer, as_attachment=True, download_name="Test video")


    


    However, I struggle when trying to pull in higher quality videos as they come in as separate audio and videos streams (see documentation here : https://pytube.io/en/latest/user/streams.html#)

    


    I am trying to use ffmpeg to combine the two and then send to the user, but the code below isn't working as expected and throws an error :

    


    Code :

    


    import os
import flask
from flask import redirect, url_for, session, send_file
import requests
import ffmpeg

import pytube
from pytube import YouTube
from io import BytesIO

@app.route('/pull_videos', methods = ['GET', 'POST'])
def pull_videos(): 
  buffer=BytesIO()
  
  video = yt_test.streams.get_by_itag(137)
  input_video = ffmpeg.input(video)
  
  audio = yt_test.streams.get_by_itag(137)
  input_audio = ffmpeg.input(audio)
  
  combined = ffmpeg.concat(input_video, input_audio, v=1, a=1)
  combined.stream_to_buffer(buffer)
  buffer.seek(0)

  return send_file(buffer, as_attachment=True, download_name="Test video")


    


    Error : AttributeError : 'FilterableStream' object has no attribute 'stream_to_buffer'

    


    How could I combine these audio and video streams from PyTube into one file for the user to download without storing on the server ?

    


  • How do I use gpg to verify an ffmpeg source snapshot download ? [closed]

    2 novembre 2024, par Neddie

    I downloaded two files :

    


    ffmpeg-snapshot.tar.bz2
ffmpeg-devel.asc


    


    The .asc file looks like this :

    


    -----BEGIN PGP PUBLIC KEY BLOCK-----

    


    mQENBE22rV0BCAC3DzRmA2XlhrqYv9HKoEvNHHf+PzosmCTHmYhWHDqvBxPkSvCl
...
+x8ETJgPoNK3kQoDagApj4qAt83Ayac3HzNIuEJ7LdvfINIOprujnJ9vH4n04XLg
I4EZ
=Rjbw
-----END PGP PUBLIC KEY BLOCK-----

    


    The command

    


    gpg --show-keys ffmpeg-devel.asc


    


    gives

    


    pub   rsa2048 2011-04-26 [SC]
      FCF986EA15E6E293A5644F10B4322F04D67658D8
uid                      FFmpeg release signing key <ffmpeg-devel@ffmpeg.org>
sub   rsa2048 2011-04-26 [E]


    


    The command

    


    gpg --verify ffmpeg-devel.asc ffmpeg-snapshot.tar.bz2


    


    gives output

    


    gpg: verify signatures failed: Unexpected error


    


    I tried decompressing the bz2 file and then

    


    gpg --verify ffmpeg-devel.asc ffmpeg-snapshot.tar


    


    and got the same error.

    


    What am I missing ?