Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
FFmpeg Not Working on Windows Opens New CMD Window Then Closes [closed]
9 juillet, par D PlusI recently downloaded the FFmpeg binary for Windows. I unzipped it navigated to the bin folder using CMD, and tried to run
ffmpeg -version
But when I do that, instead of showing any output, it opens a new CMD window for a second and then it closes immediately. The original CMD stays empty no errors, no output.I've tried:
- Navigating manually to the bin folder using cd
- Calling .\ffmpeg.exe -version
- Using full path like "C:\path\to\ffmpeg\bin\ffmpeg.exe" -version
- Checking if the .exe file is blocked in Properties (nothing to unblock)
- Redirecting output using ffmpeg -version > output.txt (file is empty)
Still, no luck.
Has anyone experienced this? Any ideas on what I might be missing?
-
ffmpeg rotate filter - how to format in complex filter [closed]
9 juillet, par Giles BradshawI can't get this to work and wondering if anyone could help
command is
ffmpeg -y -i "input/002 David Lynch Music Video.mp4" -filter_complex "[0:v]rotate=-185:ow=rotw(iw,ih):oh=roth(iw,ih):c=black@0[clip_0155_0_d16f34]" -map [clip_0155_0_d16f34] -c:v libx264 -preset veryfast -crf 23 -r 30 -vsync 2 -pix_fmt yuv420p -fflags +genpts -an /tmp/video_montage_si9nw2x2/clip_0155_0_d16f34.mp4
it gives me
[AVFilterGraph @ 0x5557af6a6c80] No such filter: 'ih):oh' Error initializing complex filters. Invalid argument
-
av1 -colorspace bt709 Error reinitializing filters [closed]
9 juillet, par Voxffmpeg 7.1.1 svt-av1 2.3.0 command:
./ffmpeg7 -y -i src.mp4 -c:v libsvtav1 -colorspace bt709 -an -f mp4 out.mp4
src.mp4:
color_range=tv color_space=ycgco color_primaries=bt709 color_transfer=bt709
I get error:
[vf#0:0 @ 0x56391fc13e00] Error reinitializing filters! [vf#0:0 @ 0x56391fc13e00] Task finished with error code: -22 (Invalid argument) [vf#0:0 @ 0x56391fc13e00] Terminating thread with return code -22 (Invalid argument) [vost#0:0/libsvtav1 @ 0x56391fc13fc0] Could not open encoder before EOF [vost#0:0/libsvtav1 @ 0x56391fc13fc0] Task finished with error code: -22 (Invalid argument) [vost#0:0/libsvtav1 @ 0x56391fc13fc0] Terminating thread with return code -22 (Invalid argument) [out#0/mp4 @ 0x56391fbefb40] Nothing was written into output file, because at least one of its streams received no packets.
If I remove
-colorspace bt709
, this works fine.Please someone help me.
-
Can I use t with drawbox to simulate a playhead over a waveform in a generated video ?
9 juillet, par terrorrussia-keeps-killingI want to simulate a playhead moving over a waveform, like when playing a track in an audio editor. As far as I understand, I can generate this effect if I have both the audio file and an image of the waveform.
declare -r DURATION=$(ffprobe -i audio.flac -show_entries format=duration -v quiet -of csv="p=0") ffmpeg -hide_banner -loop 1 -framerate 30 -i waveform.png -i audio.flac \ -filter_complex " drawtext=text='%{pts\\:hms} -- %{n} -- %{pts\\:flt}':x=32:y=32:fontsize=24:fontcolor=black@0.75:box=1, drawbox=x=t*${DURATION}/iw/10000000:y=0:w=16:h=ih:color=CC1144@0.5:t=fill " \ -map 1:a -shortest -t 5 -pix_fmt yuv420p playhead.mp4
What it does:
- Retrieves the duration of
audio.flac
. - Generates a video using
waveform.png
as a static background andaudio.flac
as the audio track. Usingdrawtext
, I overlay time information on the video, and withdrawbox
I attempt to render the moving playhead. (For quicker testing, I limit the video to the first 5 seconds.)
Note that I divide
t
by 10000000 just to make the box appear at all (otherwise it seems to be so big that it cannot fit the viewport). For whatever reason the box remains static, and I don't think thatt
even changes.What detail am I missing, and how can I at least obtain the value of
t
(for debug), so I can make the box move in sync with the current timestamp? - Retrieves the duration of
-
UserWarning : x bytes wanted but 0 bytes read at frame index y (out of a total z frames), at time q sec. Using the last valid frame instead
9 juillet, par WizI have a script which subclips a larger video and then stitches needed parts together using concatenate and write video file in moviepy. But the problem is everytime i run the script i get the video but the audio is off sync, usually the audio starts normally, but over time becomes delayed. I suspect it is because i want to concatenate around 220 smaller mp4 videos into one big mp4 video, but every smaller clips receives the error:'UserWarning: In file test.mp4, 1555200 bytes wanted but 0 bytes read at frame index y (out of a total y+1 frames), at time x sec. Using the last valid frame instead.'
I use moviepy v2
MY CODE (it doesnt produce any strict errors, but does give the aformentioned UserWarning when writing video_unsilenced.mp4):
n = 0 cuts = [] input_paths = [] vc = [] os.makedirs(r"ShortsBot\SUBCLIPS") for timer in range(len(startsilence)-1): w = VideoFileClip(r"ShortsBot\output\cropped_video.mp4").subclipped(endsilence[n],(startsilence[n+1]+0.5)) w.write_videofile(r"ShortsBot\SUBCLIPS\video" + str(n) + ".mp4") a = VideoFileClip(r"ShortsBot\SUBCLIPS\video" + str(n) + ".mp4") vc.append(a) n+=1 output_fname = "video_unsilenced.mp4" clip = mpy.concatenate_videoclips(clips=vc, method= 'compose') clip.write_videofile(filename=output_fname, fps=30) _ = [a.close() for a in vc]
Because moviepy is shaving off a frame or two for every video clip and at the same time writing the audio of the concatenated clip normally (without shaving off the audio that is in the missing frames), the video and audio slowly become out of sync.And the more clips i want to concatenate, the more the audio becomes out of sync, basically confirming my suspicion that it is because moviepy is using the last valid frame and writing the audio normally. The question i have is how can i fix this?
EDIT: Full error message (although this error message appears after every clip that needs to be concatenated, usually, just like in this error message, its one or two frames that are invalid): C:\Users\user\miniconda3\envs\myenv\Lib\site-packages\moviepy\video\io\ffmpeg_reader.py:190: UserWarning: In file C:\Users\user\Desktop\File\Subclips\video317.mp4, 1555200 bytes wanted but 0 bytes read at frame index 99 (out of a total 100 frames), at time 3.30/3.34 sec. Using the last valid frame instead.