[bugfix] fix load audio from local video path when USE_AUDIO_IN_VIDEO (fix #8332)#8339
[bugfix] fix load audio from local video path when USE_AUDIO_IN_VIDEO (fix #8332)#8339alphadl wants to merge 1 commit intomodelscope:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a bug preventing audio extraction from local video files when the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Please take a look when you have time. This fixes loading audio from local video files (e.g. .mp4) when |
There was a problem hiding this comment.
Code Review
This pull request correctly addresses a bug where loading audio from local video files would fail. The fix extends the existing logic for handling video URLs to also cover local video file paths by using audioread to decode the audio stream before passing it to librosa. My review includes a suggestion to refactor the new logic to improve code clarity and reduce duplication.
[bugfix] fix load audio from local video path when USE_AUDIO_IN_VIDEO (fix #8332)
#8332
With
USE_AUDIO_IN_VIDEO=True, loading audio from a local video path (e.g..mp4) passed the path directly tolibrosa.load(). Librosa/soundfile do not support video containers, which caused:URLs were already handled via
audioread.ffdec.FFmpegAudioFile. This PR applies the same ffmpeg-based decoding for local paths when the file extension is a video format (.mp4,.webm,.avi,.mov,.mkv), so thatlibrosa.loadreceives a decoded audio stream instead of the raw path.Changes:
swift/template/templates/qwen.py: In theuse_audio_in_videobranch, ifvideois a local path with a video extension, open it withaudioread.ffdec.FFmpegAudioFile(video)before callinglibrosa.load(). No new dependencies (audioread/ffmpeg already used for URLs).