Recherche avancée

Médias (1)

Mot : - Tags -/copyleft

Autres articles (63)

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

  • Video streaming- control frame rate x264

    3 mars 2017, par H.A

    I’m new to video coding, I found this https://github.com/RafaelPalomar/H264LiveStreamer application code very useful to my project. I want to live stream a webcam over RTP . However, I’m having problem selecting the Frame Per Seconds (FPS). below is the function that controls the encoding param.

    void x264Encoder::initilize()
    {
     x264_param_default_preset(&parameters, "veryfast", "zerolatency");
     parameters.i_log_level =  X264_LOG_DEBUG;
     parameters.i_threads = 1;
     parameters.i_width = 640;
     parameters.i_height = 480;
     parameters.i_fps_num = 25;
     parameters.i_fps_den = 1;
     parameters.i_keyint_max = 25;
     parameters.b_intra_refresh = 1;
     parameters.rc.i_rc_method = X264_RC_CRF;
     parameters.rc.i_vbv_buffer_size = 1000000;
     parameters.rc.i_vbv_max_bitrate = 90000;
     parameters.rc.f_rf_constant = 25;
     parameters.rc.f_rf_constant_max = 35;
     parameters.i_sps_id = 7;
     // the following two value you should keep 1
     parameters.b_repeat_headers = 1;    // to get header before every I-Frame
     parameters.b_annexb = 1; // put start code in front of nal. we will remove start code later
     x264_param_apply_profile(&parameters, "baseline");

     encoder = x264_encoder_open(&parameters);
     x264_picture_alloc(&picture_in, X264_CSP_I420, parameters.i_width, parameters.i_height);
     picture_in.i_type = X264_TYPE_AUTO;
     picture_in.img.i_csp = X264_CSP_I420;
     // i have initilized my color space converter for BGR24 to YUV420 because my opencv video capture gives BGR24 image. You can initilize according to your input pixelFormat
     convertContext = sws_getContext(parameters.i_width,parameters.i_height, PIX_FMT_BGR24, parameters.i_width,parameters.i_height,PIX_FMT_YUV420P, SWS_FAST_BILINEAR, NULL, NULL, NULL);
    }

    I’m using VLC as client whatever number i set i_fps_num to, I always get 12-14 FPS. fore example, in VLC Codec tab shows 25 FPS but in Stream statistics tab it shows it only display 13 FPS on average. here is the X264 encoder output

    x264 [debug]: frame=  72 QP=22.24 NAL=2 Slice:P Poc:144 I:97   P:116  SKIP:987  size=1464 bytes
    x264 [info]: frame I:1     Avg QP:20.06  size: 17848
    x264 [info]: frame P:72    Avg QP:22.12  size:  1337
    x264 [info]: mb I  I16..4: 40.2%  0.0% 59.8%
    x264 [info]: mb P  I16..4:  3.1%  0.0%  2.3%  P16..4:  8.3%  2.0%  0.6%  0.0%  0.0%    skip:83.7%
    x264 [info]: coded y,uvDC,uvAC intra: 53.6% 46.4% 7.4% inter: 3.0% 1.6% 0.0%
    x264 [info]: i16 v,h,dc,p: 11% 65% 12% 12%
    x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 46% 16%  3%  4%  3%  5%  3%  6%
    x264 [info]: i8c dc,h,v,p: 46% 42% 10%  2%
    x264 [info]: kb/s:312.60

    the last frame number that was encoded is 72 while in VLC stream statistics it shows that 133 frames are Displayed and 66 blocks are decoded for 10 seconds streaming in addition the video playback is bursty.

    my question is how to change the x264 parameters to get 25 FPS ?

  • Video streaming- control frame rate x264

    3 mars 2017, par H.A

    I’m new to video coding, I found this https://github.com/RafaelPalomar/H264LiveStreamer application code very useful to my project. I want to live stream a webcam over RTP . However, I’m having problem selecting the Frame Per Seconds (FPS). below is the function that controls the encoding param.

    void x264Encoder::initilize()
    {
     x264_param_default_preset(&parameters, "veryfast", "zerolatency");
     parameters.i_log_level =  X264_LOG_DEBUG;
     parameters.i_threads = 1;
     parameters.i_width = 640;
     parameters.i_height = 480;
     parameters.i_fps_num = 25;
     parameters.i_fps_den = 1;
     parameters.i_keyint_max = 25;
     parameters.b_intra_refresh = 1;
     parameters.rc.i_rc_method = X264_RC_CRF;
     parameters.rc.i_vbv_buffer_size = 1000000;
     parameters.rc.i_vbv_max_bitrate = 90000;
     parameters.rc.f_rf_constant = 25;
     parameters.rc.f_rf_constant_max = 35;
     parameters.i_sps_id = 7;
     // the following two value you should keep 1
     parameters.b_repeat_headers = 1;    // to get header before every I-Frame
     parameters.b_annexb = 1; // put start code in front of nal. we will remove start code later
     x264_param_apply_profile(&parameters, "baseline");

     encoder = x264_encoder_open(&parameters);
     x264_picture_alloc(&picture_in, X264_CSP_I420, parameters.i_width, parameters.i_height);
     picture_in.i_type = X264_TYPE_AUTO;
     picture_in.img.i_csp = X264_CSP_I420;
     // i have initilized my color space converter for BGR24 to YUV420 because my opencv video capture gives BGR24 image. You can initilize according to your input pixelFormat
     convertContext = sws_getContext(parameters.i_width,parameters.i_height, PIX_FMT_BGR24, parameters.i_width,parameters.i_height,PIX_FMT_YUV420P, SWS_FAST_BILINEAR, NULL, NULL, NULL);
    }

    I’m using VLC as client whatever number i set i_fps_num to, I always get 12-14 FPS. fore example, in VLC Codec tab shows 25 FPS but in Stream statistics tab it shows it only display 13 FPS on average. here is the X264 encoder output

    x264 [debug]: frame=  72 QP=22.24 NAL=2 Slice:P Poc:144 I:97   P:116  SKIP:987  size=1464 bytes
    x264 [info]: frame I:1     Avg QP:20.06  size: 17848
    x264 [info]: frame P:72    Avg QP:22.12  size:  1337
    x264 [info]: mb I  I16..4: 40.2%  0.0% 59.8%
    x264 [info]: mb P  I16..4:  3.1%  0.0%  2.3%  P16..4:  8.3%  2.0%  0.6%  0.0%  0.0%    skip:83.7%
    x264 [info]: coded y,uvDC,uvAC intra: 53.6% 46.4% 7.4% inter: 3.0% 1.6% 0.0%
    x264 [info]: i16 v,h,dc,p: 11% 65% 12% 12%
    x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 46% 16%  3%  4%  3%  5%  3%  6%
    x264 [info]: i8c dc,h,v,p: 46% 42% 10%  2%
    x264 [info]: kb/s:312.60

    the last frame number that was encoded is 72 while in VLC stream statistics it shows that 133 frames are Displayed and 66 blocks are decoded for 10 seconds streaming in addition the video playback is bursty.

    my question is how to change the x264 parameters to get 25 FPS ?

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