Recherche avancée

Médias (3)

Mot : - Tags -/Valkaama

Autres articles (46)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

  • Personnaliser l’affichage de mon Médiaspip

    27 mai 2013

    Vous pouvez modifier la configuration du squelette afin de personnaliser votre Médiaspip Voir aussi plus d’informations en suivant ce lien
    Comment supprimer le nombre de vues d’affichage d’un média ?
    Administrer > Gestion du squelette > Pages des articles et médias Cocher dans "Informations non affichées sur les pages de médias" les paramètres que vous ne souhaitez pas afficher.
    Comment supprimer le titre de mon Médiaspip dans le bandeau horizontal ?
    Administrer > Gestion du squelette > (...)

Sur d’autres sites (6973)

  • How can I change slice_type which is show in Elecard stream analyzer using ffmpeg ?

    10 octobre 2018, par Tooraj Jam

    I’m not ffmpeg and encodding expert and am trying to encode a MP4 file to MPEG-4 h264 .ts file.

    When Elecard stream analyzer is analyzing my result .ts file, it shows slice_type = 7 for all of i-frames as you can see in the attached screenshot.

    How can I change all these to slice_type = 2 ?

    My ffmpeg command :

    -i Source.mp4 \
    -filter:v 'setpts=0+PTQ-STARTPTS' -metadata:s:v:0 start_time=0 \
    -f adts -c:a libfdk_aac  -profile:a aac_he  -strict -2 -ar 48000 -b:a 48k \
    -f mpegts -c:v libx264  -vbsf h264_mp4toannexb -strict experimental -    profile:v main -level:v 3.0 -preset:v slow -movflags faststart -pat_period 100 \
    -x264opts nal-hrd=cbr:force-cfr=1 -crf 25 -vf scale=w=640:h=360 -aspect 16:9 \
    -bf 1  -sc_threshold 0 -keyint_min 2*25 -g 2*25 \
    -force_key_frames "expr:gte(t,n_forced*50)" -max_muxing_queue_size 1500k \
    -coder 1  -refs 2 \
    -b:v 750k -minrate 750k -maxrate 750k -bufsize 1500k \
    -vsync 1 -framerate 25000/1001 \
    -x264opts "bitrate=750:vbv-maxrate=750:vbv-bufsize=1500"\
    -pix_fmt yuv420p  -r 25 -x264opts force-cfr \
    -mbs_per_slice 1 -y dest.ts

    enter image description here

  • OpenCV Videocapture vs FFMPEG irregularities in PTS / PTS_TIME calculation

    9 décembre 2022, par rmalchow

    I am using FFMPEG scene detection to split videos on edits. The scene detection isn't perfect, but good enough for the purpose. The trouble starts when I try to extract frames using OpenCV.

    


    With scene detection, the frames are filtered, so the frame numbers are just the ones selected. What I still get is the PTS though, and the PTS_TIME. I checked some of those calculations from FFMPEG, and they all appear correct. To see pairs of frame number to PTS, I use this :

    


    ffmpeg -i $CLIP -filter:v "showinfo" -f null -


    


    If now use

    


      vc.set(cv2.CAP_PROP_POS_MSEC, int(pts_time*1000.0))


    


    I then test the frame number with :

    


      vc.get(cv2.CAP_PROP_POS_FRAMES)


    


    i get the same frame number that ffmpeg would show at this point. However - for some clips, this is slightly off - usually 1 or sometimes 2 frames.

    


    So where FFMPEG sees this (without any filtering) :

    


      Stream #0:0(und)
  24 fps, 24 tbr, 24k tbn, 48 tbc (default)
  [...]
  n:1175 pts:1177000 pts_time:49.0417


    


    OpenCV sees this :

    


      pts_time: 49.04178 / frame: 1177


    


    as you can see, this is 2 frames off. For a "good" clip, I get from FFMPEG :

    


      Stream #0:0(eng): 
  23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default) (original)
  [...]
  n:3122 pts: 130213 pts_time:130.213


    


    and OpenCV sees the same :

    


      pts_time: 130.2130 / frame: 3122


    


    The offset in the "bad" clip is constant (2 frames) throughout the entire clip, so I think this is not a rounding error of some sort. Is this OpenCV making a BooBoo ?

    


    I could use the Information from FFMPEG to pick a frame number in OpenCV and set CAP_PROP_POS_FRAMES instead of CAP_PROP_POS_MSEC ... but it would be a bit troublesome, since i would need to parse out the TBN, and since "-print_format json" still is a cruel joke rather than anything useful, I am trying to avoid that ...

    


    How can I make this frame accurate ?

    


    .rm

    


  • x264 encoding timebase calculation

    4 mars 2018, par rosewater

    I have yuv frames that I am converting to h264 frames using libx264 successfully. I know the time difference between each frame. Then I use the following ffmpeg command to convert h264 video file to mp4 :

    ffmpeg.exe -i frames.h264 -c:v copy -f mp4 frames.mp4

    This works. However I can’t figure out how to set the variable frame rate properly. The movie plays too fast. I don’t have fixed frame rate, otherwise I would set that and the resulting mp4 is the correct duration.

    I have the time difference between each frame in milliseconds. How can I set the timebase and pts so that when I convert the h264 file to mp4, it is the correct duration.

    bool X264Encoder::init(int width, int height,
    AVRational &timebase,  // what should timebase be?
    int fps)
    {
      x264_param_t param;
       if( x264_param_default_preset( &param, "medium", NULL ) < 0 )
       { return false; }

       /* Configure non-default params */
       param.i_bitdepth = 8;
       param.i_csp = X264_CSP_I420;
       param.i_width  = width;
       param.i_height = height;
       param.b_vfr_input = 0;
       param.b_repeat_headers = 1;
       param.b_annexb = 1;
       if(0) // don't have fixed frame rate, can't use it
       {
           param.b_vfr_input = 0;
           param.i_fps_num = 4;
           param.i_fps_den = 1;
       }
       else
       {
           param.b_vfr_input = 1;
           param.i_timebase_num = timebase.den;
           param.i_timebase_den = timebase.num;
       }

       if( x264_param_apply_profile(&param, "high" ) < 0 )
       { return false; }

       m_pic_in = new x264_picture_t;
       x264_picture_init(m_pic_in);
       m_pic_in->img.i_csp = X264_CSP_I420;
       m_pic_in->img.i_plane = 3;

       m_encoder = x264_encoder_open(&param);

    }

    //This is called for each frame
    void X264Encoder::encode(uint8_t *plane[4], int64_t pts) // what should pts be?
    {
       m_pic_in->img.plane[0] = plane[0];  // Y frame
       m_pic_in->img.i_stride[0] = m_width;
       m_pic_in->img.plane[1] = plane[1];  // U frame
       m_pic_in->img.i_stride[1] = m_width;
       m_pic_in->img.plane[2] = plane[2];  // V frame
       m_pic_in->img.i_stride[2] = m_width;

       x264_picture_t pic_out;
       m_pic_in->i_pts = pts;
       int frame_size = x264_encoder_encode(m_encoder, &m_nals, &m_i_nals, m_pic_in, &pic_out);

       if(frame_size <= 0)
       {
           return;
       }

       writeH264Frame(m_nals->p_payload, frame_size); // basically same as fwrite
    }