Advanced search

Medias (91)

Other articles (28)

  • Support audio et vidéo HTML5

    10 April 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

  • HTML5 audio and video support

    13 April 2011, by

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • De l’upload à la vidéo finale [version standalone]

    31 January 2010, by

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier; La génération d’une vignette : extraction d’une (...)

On other websites (5880)

  • FFMPEG audio through strip, cut, concate is out of sync

    3 October 2022, by Cospel

    I'm trying to solve several use-cases, first is stripping audio out of the video (.mov, .mp4, .mkv, ...). I'm using this command (for removing video stream and copying audio stream):

    


    ffmpeg -i movie.mov -vn -c:a copy strip_audio.aac


    


    However, the resulting audio (strip_audio.aac) is shorter (by a few ms) than audio detached from movie.mov in iMovie. strip_audio.aac is also progressively out of sync. See screenshot below, btw video audio and strip_audio.acc.

    


    The second problem is that I'm trying to divide the video into small segments (3 seconds) and then concatenating them again. For creating chunks/cutting the video, I used this command:

    


    ffmpeg -i video.mov -ss 00:00:00 -t 3 0000.mov
ffmpeg -i video.mov -ss 00:00:03 -t 3 0001.mov
...


    


    Then I concatenate the segment parts via this command:

    


    ffmpeg -f concat -safe 0 -i listfile.txt -c:v copy -vsync 0 concat-result.mov


    


    However, in the first chunk, the audio is already out of sync at the beginning (there is a visible empty gap). And concatenating parts have small glitches between each other in audio tracks.

    


    So my questions are:

    


      

    1. Is it possible to strip audio via FFmpeg that will not be out of sync and has the exact length of the original audio?
    2. 


    3. Is it possible to merge chunks without any corruption/glitches?
    4. 


    5. Why is first chunk corrupted in beginning and how to solve it?
    6. 


    


    I tried almost everything that I saw on StackOverflow, but I still, get a lot of glitches when concatenating and the out-of-sync audio. I have FFmpeg in version 5.0.1.

    


    Video and audio visualized in iMovie

    


    Update 1:
If I create (just audio) chunks of .flac and then concatenate them, then there are no glitches between concatenating chunks. However, the first chunk is corrupted in the beginning and the audio stream is progressively out-of-sync. I found this repository which I used to create flac chunks and then concatenate audio.

    


  • ffmpeg break up videos with frame persecond

    25 May 2018, by jameshwart lopez

    Theres a command to extract images of a video providing frame per seconds

    ffmpeg -i "vide.mp4" -vf fps=1 frames/frame_%04d.png -hide_banner

    Is there a command in ffmpeg to cut video providing fps and save it as video(.mp4 / avi) file like the command above?

    What i currently have is i created a method to cut the videos with start and endtime but i firstly created a method to get the length of a video so that i could cut the video base on how many frames that was generated by the above command.

    def get_length(self):
           """
           Gets the length of a video in seconds

           Returns:
               float : Length of the video
           """

           print("Getting video length: " + self.video_string_path)
           command = 'ffprobe -i "'+self.video_string_path+'" -show_entries format=duration -v quiet -of csv="p=0"'
           self.command = command
           length = str(cmd.execute(command)).strip()
           print("lenght: "+length+" second(s)")
           return float(length)

    def cut(self, start_time, duration, output_file_name = 'output_file_name.mp4', save_to =''):
           """
           Cut a video on a specific start time of the video and duration.
           Check ffmpeg documentation https://ffmpeg.org/ffmpeg.html for more information about the parameters

           Parameters:
               start_time : string
                   is the value of ffmpeg -ss with the format: 00:00:00.000

               duration : string | int | float
                   is the end point where the video will be cut. Can be the same with start_time format but it could also handle integer as in seconds

               output_file_name : string
                   is the file name once the file is save in the hardisk

               save_to : string | optional
                   is the directory where the file will be saved

           Returns:
               string: file location of the cutted video

           """

           self.make_sure_save_dir_exits(save_to)
           print('Cutting ' + self.video_string_path + ' from ' + start_time + ' to ' + str(duration))
           print('Please wait...')
           file = '"' + self.save_to + output_file_name + '"'
           command = 'ffmpeg -i "' + self.video_string_path + '" -ss ' + str(start_time) + ' -t ' + str(duration) + ' -c copy -y ' + file
           self.command = command
           cmd.execute(command)

           file_loc = self.get_save_to_dir() + output_file_name
           print('Done: Output file was saved to "' + file_loc + '"')

           return file_loc + output_file_name
  • Converting any video to iPhone - transcoding logic/algorithm?

    28 September 2012, by cajwine

    I have many-many video files in different formats (mostly avi). For example, some relevant lines from ffprobe:

     Duration: 02:27:14.70, start: 0.000000, bitrate: 664 kb/s
       Stream #0.0: Video: mpeg4, yuv420p, 608x256 [PAR 1:1 DAR 19:8], 23.98 tbr, 23.98 tbn, 23.98 tbc
       Stream #0.1: Audio: mp3, 44100 Hz, stereo, s16, 96 kb/s

     Duration: 00:20:51.84, start: 0.000000, bitrate: 3286 kb/s
       Stream #0.0: Video: mpeg4, yuv420p, 640x480 [PAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
       Stream #0.1: Audio: mp3, 48000 Hz, stereo, s16, 128 kb/s

     Duration: 01:26:01.84, start: 0.000000, bitrate: 845 kb/s
       Stream #0.0: Video: mpeg4, yuv420p, 704x544 [PAR 1:1 DAR 22:17], 25 fps, 25 tbr, 25 tbn, 30k tbc
       Stream #0.1: Audio: mp3, 44100 Hz, stereo, s16, 128 kb/s

     Duration: 01:42:25.68, start: 0.000000, bitrate: 952 kb/s
       Stream #0.0: Video: h264 (High), yuv420p, 600x244 [PAR 1:1 DAR 150:61], 25 fps, 25 tbr, 25 tbn, 50 tbc
       Stream #0.1: Audio: mp3, 48000 Hz, stereo, s16, 112 kb/s

    As you can see, the bitrates, video-sizes, codecs are vary. Want write a script (bash, perl) what will convert them for iPhone with ffmpeg.

    With googling i found many different ffmpeg profiles, but all profiles are "static", e.g. converts video to same resolution and this is probably not the right way, because i have many different video resolutions with many different bitrates. (this applies for the audio too).

    I'm able write the script - but need help with one basic question.

    I need help with the algorithm how to calculate the values for ffmpeg arguments from the above ffprobe results. E.g. when have video 704x544 and 845kb/s and another video with smaller size 640x480 but 3200kb/s bitrate - how to calculate the "right values" for ffmpeg in the script?

    What is right algorithm/logic for transcoding video for the desired device? (in my case iPhone)

    If someone care, I have ffmpeg recompiled with "nonfree" codecs, and have mencoder (from mplayer package) too.

    Second: In the avi containers are many videos already in the mpeg4 format. How to determine the "fastest" converting profile? Mean a profile, where ffmpeg will only do the less-possible calculations, so probably will leave as-is: the format mpeg4, the size, the bitrate and "only" will change the container format. Is this possible?

    I was read many ffmpeg SO questions, but not find answers - maybe I missed something. Can somebody point me to some good documents?