Recherche avancée

Médias (91)

Autres articles (28)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • 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

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

Sur d’autres sites (6724)

  • ffmpeg concatenating videos of different fps while keeping the total length not changed

    23 novembre 2017, par A_Matar

    I wanna pad an mp4 video stream with another video clip of a static image that I created using :

    def generate_white_vid (duration):
       output_filename = os.path.join(p_path,'white_vid_'+" 0:.2f}".format(duration)+'.mp4')
       ffmpeg_create_vid_from_static_img = 'ffmpeg -loop 1 -i /path/WhiteBackground.jpg -c:v libx264 -t %f -pix_fmt yuv420p -vf scale=1920:1080 %s' % (duration, output_filename)
       p = subprocess.Popen(ffmpeg_create_vid_from_static_img, shell=True)
       p.communicate()
       return output_filename

    I use the following to concatenate :

    def concat_vids(clip_paths):
       filenames_txt = open('clips_to_join.txt','w')
       for clip in clip_paths:
           filenames_txt.write ('file \''+ clip+'\'\n')
       filenames_txt.close()
       output_filename = clip_paths[0].split('.', 2)[0]
       output_file_path = os.path.join(root_path, output_filename+'-padded.mp4')
       # join the clips
       ffmpeg_command = ["ffmpeg", "-f", "concat", "-safe", "0", "-i", "clips_to_join.txt", "-codec", "copy", output_file_path] # output_filename = ch0X-start_time-end_time
       p = subprocess.Popen(ffmpeg_command)
       p.communicate() # wait till the subprocess finishes. You can send commands to process as well.
       return output_file_path

    When I check the length of the resulting video after concatenation, I find that it is not equal to the sum of the two segments that I concatenated, and sometimes it is even less by some seconds !!

    Here is how I get the video length in seconds :

    def ffmpeg_len(vid_path):
       '''
       Returns length in seconds using ffmpeg
       '''
       ffmpeg_get_mediafile_length = ['sh', '-c', 'ffmpeg -i "$1" 2>&1 | grep Duration', '_', vid_path]
       p = subprocess.Popen(ffmpeg_get_mediafile_length, stdout=subprocess.PIPE, stderr=subprocess.PIPE)    
       output, err = p.communicate()
       length_regexp = 'Duration: (\d{2}):(\d{2}):(\d{2})(\.\d+),'
       re_length = re.compile(length_regexp)
       matches = re_length.search(output)
       if matches:
           video_length = int(matches.group(1)) * 3600 + \
                           int(matches.group(2)) * 60 + \
                           int(matches.group(3)) + float(matches.group(4))
           return video_length
       else:
           print("Can't determine video length.")
           print err
           raise SystemExit

    My guess is that maybe the concatenation unifies the fps rate for the all the clips to be joined, if this is the case, how to prevent this from happening ? How can I get a video of the desired length exactly.

    Maybe it worth mentioning that the video to padded is very short 0.42 second, the original video is 210.58 and the resultant video is 210.56 !

    I have verified that ffmpeg does generate the desired padding region and it is of the desired length 0.42 I got a 0.43 segment when I forced 30 fps but it is okay.

  • How to force specific AVInputFormat in code (FFMPEG) ?

    18 février 2020, par kugipark

    ++Plaease understand that maybe some words or sentences could not be correct English.++

    I’m novice programmer and developing a video player app for Android which can play 5ch .avi video from http. It based on ffplay.c in FFMPEG libarary.

    Currently I have 2 problems for this below. It has occured only in android devices.


    1) Too much time taken for detecting format.

    • opening and finding stream info takes more than a minute when I trying to open 5ch video source whereas normal .mp4 (h264) source open almost immediately.

    2) Demuxing is too slow when it comes to large size video.

    • If the resolution of video getting larger, then displaying frame rate getting slower even though there are enough memory, network and CPU resources physically.

    To resolve my problem, I tried to force the format and decoders but I couldn’t found some information for specifying the input source in code level.
    The official doc site only refers to a sentence about those parameters like "If non-NULL, this parameter forces a specific input format. Otherwise the format is autodetected.". So I don’t have any clues how to set the number of streams, decoders, decoders’ private options, and etc. (And also which parameters should I manage.) If someone knows how to set the options(like AVDictionary), and pass to the av functions, please let me know an exmple. The source contains 2 video streams, 1 audio stream, and 2 more extra streams (for custom data like gps). The stream information of video is below. I printed it manually, and these are auto-detected information.

       ---------- File format information ----------
    flags=2097152
    video_codec_id=0 (NONE)
    audio_codec_id=0 (NONE)
    ctx_flags=0
    data_codec_id=0 (NONE)
    format_whitelist=(null)
    iformat=0xa19d0d2c
    ---------- Stream information ----------
    stream 1 of 5:
    ----- common ----------
    bit_rate: 11383235
    bits_per_coded_sample: 24
    bits_per_raw_sample: 0
    codec_id: 0x1C (H264)
    codec_tag: 875967048
    extradata_size: 0
    level: -99
    profile: -99
    sample_rate: 0
    ----- Video Stream ----------
    chroma_location: 0
    color_primaries: 2
    color_space: 2
    color_trc: 2
    field_order: 0
    format: -1 (NONE)
    height: 1080
    width: 1920
    sample_aspect_ratio.den: 1
    sample_aspect_ratio.num: 0
    video_delay: 0
    ----------------------------------------
    stream 2 of 5:
    ----- common ----------
    bit_rate: 6185438
    bits_per_coded_sample: 24
    bits_per_raw_sample: 0
    codec_id: 0x1C (H264)
    codec_tag: 875967048
    extradata_size: 0
    level: -99
    profile: -99
    sample_rate: 0
    ----- Video Stream ----------
    chroma_location: 0
    color_primaries: 2
    color_space: 2
    color_trc: 2
    field_order: 0
    format: -1 (NONE)
    height: 720
    width: 1280
    sample_aspect_ratio.den: 1
    sample_aspect_ratio.num: 0
    video_delay: 0
    ----------------------------------------
    stream 3 of 5:
    ----- common ----------
    bit_rate: 352800
    bits_per_coded_sample: 16
    bits_per_raw_sample: 0
    codec_id: 0x10000 (PCM_S16LE)
    codec_tag: 1
    extradata_size: 0
    level: -99
    profile: -99
    sample_rate: 22050
    ----- Audio Stream ----------
    block_align: 2
    channels: 1
    channel_layout: 0
    color_range: 0
    frame_size: 0
    initial_padding: 0
    seek_preroll: 0
    trailing_padding: 0
    ----------------------------------------
    stream 4 of 5:
    ----- common ----------
    bit_rate: 15625
    bits_per_coded_sample: 0
    bits_per_raw_sample: 0
    codec_id: 0x0 (NONE)
    codec_tag: 0
    extradata_size: 0
    level: -99
    profile: -99
    sample_rate: 0
    ----- Subtitle Stream ----------
    ----------------------------------------
    stream 5 of 5:
    ----- common ----------
    bit_rate: 33862
    bits_per_coded_sample: 0
    bits_per_raw_sample: 0
    codec_id: 0x0 (NONE)
    codec_tag: 0
    extradata_size: 0
    level: -99
    profile: -99
    sample_rate: 0
    ----- Subtitle Stream ----------
  • examples : Add a VA-API encode example.

    6 novembre 2017, par Jun Zhao
    examples : Add a VA-API encode example.
    

    Supports only raw NV12 input.

    Example use :
    ./vaapi_encode 1920 1080 test.yuv test.h264

    Signed-off-by : Jun Zhao <jun.zhao@intel.com>
    Signed-off-by : Liu, Kaixuan <kaixuan.liu@intel.com>
    Signed-off-by : Mark Thompson <sw@jkqxz.net>

    • [DH] configure
    • [DH] doc/examples/Makefile
    • [DH] doc/examples/vaapi_encode.c