Skip to content
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

Fix error on loading audio of the input video, as described in issue #163. #164

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,17 @@ The following checkpoints are the full weights (visual encoder + audio encoder +
## Usage
#### Environment Preparation

First, install ffmpeg.
```
apt update
apt install ffmpeg
```
Then, create a conda environment:
First, create a conda environment:
```
conda env create -f environment.yml
conda activate videollama
```
Second, install `ffmpeg` and `ffmpeg-python`.
```
apt update
apt install ffmpeg
pip install ffmpeg-python
```


## Prerequisites
Expand Down
5 changes: 4 additions & 1 deletion video_llama/conversation/conversation_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, LlamaTokenizer
from transformers import StoppingCriteria, StoppingCriteriaList
import ffmpeg

import dataclasses
from enum import auto, Enum
Expand Down Expand Up @@ -252,7 +253,9 @@ def upload_video(self, video_path, conv, img_list):

try:
audio_flag = 1
audio = load_and_transform_audio_data([video_path],"cpu", clips_per_video=8)
audio_path = video_path[:-3] + 'wav'
ffmpeg.input(video_path).output(audio_path).run(overwrite_output=True, quiet=True)
audio = load_and_transform_audio_data([audio_path],"cpu", clips_per_video=8)
audio = audio.to(self.device)
except :
print('no audio is found')
Expand Down