
Recherche avancée
Médias (3)
-
MediaSPIP Simple : futur thème graphique par défaut ?
26 septembre 2013, par
Mis à jour : Octobre 2013
Langue : français
Type : Video
-
GetID3 - Bloc informations de fichiers
9 avril 2013, par
Mis à jour : Mai 2013
Langue : français
Type : Image
-
GetID3 - Boutons supplémentaires
9 avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
Autres articles (39)
-
HTML5 audio and video support
13 avril 2011, parMediaSPIP 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 janvier 2010, parLe 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 (...) -
Librairies et binaires spécifiques au traitement vidéo et sonore
31 janvier 2010, parLes logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
Binaires complémentaires et facultatifs flvtool2 : (...)
Sur d’autres sites (5205)
-
audio issues when merging a video with an audio file using python ffmpeg and moviepy
29 février 2024, par Stevenb123I’m trying to create a code that syncs between an audio file and a background file in terms of duration.
When creating the merged video I hear a cut or a loop sound of the last sentence for like 0.2 seconds.
I have tried to solve it in many different ways, listed below.


Has anyone solved this issue ? I saw many people having a similar problem.
I’m using Ubuntu version 20.04 and ffmpeg version 4.2.7


This is my code :


def merge_videos_with_subs(
 background_path, audio_path, subs, output_directory, output_filename
):
 try:
 # Load background video and audio
 background_clip = VideoFileClip(background_path)
 background_clip = background_clip.without_audio()
 audio_clip = AudioFileClip(audio_path)

 # Adjust video duration to match audio duration
 audio_duration = audio_clip.duration

 # If the background video is longer, trim it to match the audio duration
 if background_clip.duration > audio_duration:
 background_clip = background_clip.subclip(0, audio_duration)
 # If the audio is longer, loop the background video
 else:
 background_clip = background_clip.loop(duration=audio_duration)

 # Set audio of the background clip
 background_clip = background_clip.set_audio(audio_clip)

 # Overlay subtitles on the video
 final_clip = CompositeVideoClip(
 [background_clip, subtitles.set_pos(("center", "bottom"))]
 )

 # Ensure the output directory exists
 os.makedirs(output_directory, exist_ok=True)

 # Define the output path
 output_path = os.path.join(output_directory, output_filename)

 # Write the merged video with subtitles
 final_clip.write_videofile(
 output_path, codec="libx264", audio_codec="aac", threads=4, fps=24
 )

 # Close the clips
 final_clip.close()
 background_clip.close()
 audio_clip.close()

 print(f"Merged video with subtitles saved to: {output_path}")
 except Exception as e:
 print(f"Error merging videos: {e}")



I’ve tried changing the codec, tried cutting 0.2 seconds of the audio before and after the merge or silencing it, nothing seems to help.

When I run my code without the background subclip to match the audio it worked flawlessy.
If I let the background run until its full duration or make it loop there were no audio issues.

Looks like the issue is on the cutting part.

-
How to merge two audio files while retaining correct timings with ffmpeg
31 août 2017, par andyDisclaimer : I don’t understand ffmpeg and mostly just copy commands
I have two webm video files. Their duration is off by about a second.
I converted these to mp4 and everything was fine :
ffmpeg -acodec libopus -i 1.webm -r 10 -cpu-used 5 -c:v libx264 -crf 20 -c:a aac -strict experimental -loglevel error 1.mp4
I then extracted the audio from each video and everything was fine. By fine, I mean, when I playback the audio files by themselves they match the timings on the original video. I used this command to extract the audio :
fmpeg -i 1.mp4 -map 0:a -vn -acodec copy 1audio.m4a
I now have two audio tracks and I want to combine them into one, I want to "overlay" them, AND I want to keep the timings the same as they were.
BUT, whenever I try and combine the audio the timings are off. The "seconds" don’t match the original single audio files.
I have tried these commands to merge the audio :
ffmpeg -i 1audio.m4a -i 2audio.m4a -filter_complex "[0:a][1:a]amerge=inputs=2[a]" -map [a] -c:a libfdk_aac mergedaudio.m4a
ffmpeg -i 2audio.m4a -i 1audio.m4a -filter_complex amix=inputs=2:duration=first mergedaudio.m4a
ffmpeg -i 1audio.m4a -i 2audio.m4a -filter_complex amerge -ac 2 -c:a libfdk_aac -vbr 4 mergedaudio.m4a
All the above command have resulted in a merged audio file... but the timings are off.
What am I doing wrong ?
-
lavc/cbs_av1 : restore CodedBitstreamAV1Context when AVERROR(ENOSPC)
28 septembre 2022, par Haihao Xianglavc/cbs_av1 : restore CodedBitstreamAV1Context when AVERROR(ENOSPC)
The current pbc might be small for an obu frame, so a new pbc is
required then parse this obu frame again. Because
CodedBitstreamAV1Context has already been updated for this obu frame, we
need to restore CodedBitstreamAV1Context, otherwise
CodedBitstreamAV1Context doesn't match this obu frame when parsing obu
frame again, e.g. CodedBitstreamAV1Context.order_hint.$ ffmpeg -i input.ivf -c:v copy -f null -
[...]
[av1_frame_merge @ 0x558bc3d6f880] ref_order_hint[i] does not match
inferred value : 20, but should be 22.
[av1_frame_merge @ 0x558bc3d6f880] Failed to write unit 1 (type 6).
[av1_frame_merge @ 0x558bc3d6f880] Failed to write packet.
[obu @ 0x558bc3d6e040] av1_frame_merge filter failed to send output
packetReviewed-by : James Almer <jamrial@gmail.com>
Reviewed-by : Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by : Haihao Xiang <haihao.xiang@intel.com>