You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am processing an mp4 file with non-zero video start time. Such files can e.g. be generated by using the -itsoffset parameter in ffmpeg. When I clip a part of the video in the beginning (where there is audio and no video), the write_audiofile behaviour is not consistent. The first time, the correct audio is written, the second time, the clip offset seems relative to the beginning of the video rather than to the beginning of the audio (=entire file).
More in detail: when I have an mp4 where the video starts 5 seconds after the audio (video_offset = 5), and want to make a clip that starts 3 second into the file (clip_offset = 3), the first time I run write_audiofile, the audio correctly starts 3 seconds after the beginning of the file. The second time I run write_audiofile, the audio seems to start 8 seconds (=video_offset + audio_offset) after the beginning of the file.
Note that if I write the whole video instead of only the audio, the audio is still offset with the same amount. The video seems to be clipped correctly.
Expected Behavior
write_audiofile, for the same input, should give the same output. In the reproduction below: audio starting 3s after the beginning of the file.
Actual Behavior
write_audiofile, for the same input, gives a different output. The first time, audio starts 3s after the beginning of the file, the 2nd time it starts 8s after the beginning of the file.
Steps to Reproduce the Problem
import moviepy
video = moviepy.VideoFileClip("shift.mp4")
clip = video.subclipped(3, 10)
clip.audio.write_audiofile("audio1.mp3")
clip.audio.write_audiofile("audio2.mp3")
# Both files contain different audio
I am processing an mp4 file with non-zero video start time. Such files can e.g. be generated by using the
-itsoffset
parameter inffmpeg
. When I clip a part of the video in the beginning (where there is audio and no video), thewrite_audiofile
behaviour is not consistent. The first time, the correct audio is written, the second time, the clip offset seems relative to the beginning of the video rather than to the beginning of the audio (=entire file).More in detail: when I have an mp4 where the video starts 5 seconds after the audio (
video_offset = 5
), and want to make a clip that starts 3 second into the file (clip_offset = 3
), the first time I runwrite_audiofile
, the audio correctly starts 3 seconds after the beginning of the file. The second time I runwrite_audiofile
, the audio seems to start 8 seconds (=video_offset + audio_offset
) after the beginning of the file.Note that if I write the whole video instead of only the audio, the audio is still offset with the same amount. The video seems to be clipped correctly.
Expected Behavior
write_audiofile
, for the same input, should give the same output. In the reproduction below: audio starting 3s after the beginning of the file.Actual Behavior
write_audiofile
, for the same input, gives a different output. The first time, audio starts 3s after the beginning of the file, the 2nd time it starts 8s after the beginning of the file.Steps to Reproduce the Problem
shift.mp4: https://github.com/user-attachments/assets/c333cf32-3fe5-45ff-bca6-d612681ae622
Specifications
The text was updated successfully, but these errors were encountered: