-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
no sound on video output #299
Comments
@sugizo In the context of FFmpeg's complex filters, where audio and video streams are processed separately, if you only apply a video filter (like trimming the video) without addressing the audio stream, the audio may indeed be dropped or not processed as intended. Hence, they must be handled separately before being combined at the end. in_file = ffmpeg.input("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4")
out_file = ffmpeg.output( # combined two stream together
in_file.trim(duration=3), # trim the video part
in_file.atrim(duration=3), # trim the audio part
filename="output.mp4"
)
out_file.run() However, when it comes to trimming, using a complex filter is not necessary. # Direct trimming without complex filters
ffmpeg.input(
"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
).output(
"out.mp4", t=3 # Apply trimming to both video and audio
).run() |
trying with overlay but no luck
result
thanks and best regards |
The issue here is that
|
example code above not work, even trying to download the source first also not work, e.g.
test your code above
result
thanks and best regards |
That's strange, as it's functioning properly on my end.
Could you please share the FFmpeg stderr message as well? |
how to get FFmpeg stderr message already tried run it from shell in google colab, a little modified code to put parameter here's the log from shell execution above (overlay video have no sound)
objective thanks and best regards |
Please review the updated script. import ffmpeg
video = ffmpeg.input('http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4')
image = ffmpeg.input('https://cdn.creatomate.com/demo/logo.png')
video.overlay(
image, x=25, y=25, enable='between(t,0,20)'
).output(video.audio, filename='overlay.mp4', t=10).run(overwrite_output=True) |
The problem is that when ffmpeg is executed from Python, Google Colab does not display the stderr messages generated by ffmpeg. |
overlay sound work well with latest code above, thanks objective this command work well on shell, video have sound but no sound output in typed-ffmpeg
and
thanks and best regards |
import ffmpeg
video_file = ffmpeg.input('https://cdn.creatomate.com/demo/mountains.mp4')
audio_file = ffmpeg.input('http://www.jsayles.com/music/sheep.mp3')
f = video_file.video.output(audio_file.audio, filename = "add_audio.mp4",
**{'codec:v': 'libx264', # libx265 (smallest), libx264 (biggest), copy (faster because not reencoding)
'codec:a': 'aac', # aac (smallest), libmp3lame, ac3 (no sound), libtwolame (biggest), copy (faster because not reencoding)
'shortest': True, }, ) |
objective code for created 2 sources videos with audio, no problem with this code
this one return an error
result
thanks and best regards |
import ffmpeg
video_0 = ffmpeg.input('1st_3s.mp4')
video_1 = ffmpeg.input('2nd_3s.mp4')
(
ffmpeg
.filters.concat(
video_0,
video_1,
).video(0)
.output(filename="concat.mp4")
).overwrite_output().run()
|
trying code above, trying to learn from source : objective thanks and best regards |
Typed-ffmpeg serves primarily as a builder for FFmpeg CLI commands, meaning familiarity with FFmpeg filters is still required. For understanding the concat filter specifically, consider reviewing this Stack Overflow article: Understanding FFmpeg Concat. Typically, the concat demuxer is preferred for concatenation tasks as it tends to be more straightforward and faster. For concat filtering, an FFmpeg command might appear as follows: ffmpeg -i opening.mkv -i episode.mkv \
-filter_complex "[0:v] [0:a] [1:v] [1:a] \
concat=n=2:v=1:a=1 [v] [a]" \
-map "[v]" -map "[a]" output.mkv Using typed-ffmpeg, this translates to: import ffmpeg
video_0 = ffmpeg.input('opening.mkv')
video_1 = ffmpeg.input('episode.mkv')
concated = ffmpeg.filters.concat(
video_0.video,
video_0.audio,
video_1.video,
video_1.audio,
n=2, v=1, a=1
)
ffmpeg.output(
concated.video(0),
concated.audio(0),
filename="concat.mp4"
).overwrite_output().run() |
concat filter complex work with code above (video have sound), thanks does typed-ffmpeg support concat demuxer ?
run well on google colab shell
trying to translate into typed-ffmpeg, but face an error
result
thanks and best regards |
Typed-ffmpeg supports the concat demuxer, but it's crucial to correctly specify input and output options. In FFmpeg CLI, the position of options matters:
Options before
In typed-ffmpeg, this translates to: import ffmpeg
(
ffmpeg
.input('files.txt', f='concat', safe=0)
.output('concat_demuxer.mp4', c='copy')
.overwrite_output()
.run()
) |
I'll be closing this issue for now. If you have any questions or further concerns, please feel free to use the discussion section or reopen the issue. |
recently test, code
and
result expected result best regards |
environment
google colab
code
result
no sound on video output
expected result
video output have sound
best regards
The text was updated successfully, but these errors were encountered: