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

Conversion stuck at 99% #117

Open
1ncoQAQ opened this issue Dec 18, 2023 · 6 comments
Open

Conversion stuck at 99% #117

1ncoQAQ opened this issue Dec 18, 2023 · 6 comments

Comments

@1ncoQAQ
Copy link

1ncoQAQ commented Dec 18, 2023

Hello, Johnathan. Thank you very much for sharing this amazing project!
I'm running into issue when converting the video

Input #0, rawvideo, from 'fd:':
  Duration: N/A, start: 0.000000, bitrate: 43622 kb/s
  Stream #0:0: Video: rawvideo (Y800 / 0x30303859), gray, 568x320, 43622 kb/s, 30 tbr, 30 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Output #0, mp4, to 'C:\Users\11446\AppData\Local\Temp\tmparc941ei\matte.mp4':
  Metadata:
    encoder         : Lavf60.18.100
  Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p(tv, progressive), 568x320, q=2-31, 2000 kb/s, 30 fps, 15360 tbn
    Metadata:
      encoder         : Lavc60.35.100 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 0 vbv_delay: N/A
frame= 9706 fps= 11 q=2.0 size=   22016kB time=00:05:23.50 bitrate= 557.5kbits/s speed=0.359x

My video has 9723 frame, the progress stop at 9706 and not process, I'm not sure what cause that, if you could lend a hand I'd be very grateful!

OS: windows10
python: 3.10.9
torch: 2.1.2
cuda: 11.8
ffmpeg: 2023-12-14-git-5256b2fbe6-full_build

@LiveNL
Copy link

LiveNL commented Dec 21, 2023

Hi,

I'm having the same issue.

It appears that for me the while-statement below does not evaluate to False anymore at the very end and thus it keeps sleeping:

for i in range(math.ceil(total_frames / worker_nodes)):
for wx in range(worker_nodes):
hash_index = i * worker_nodes + 1 + wx
while hash_index not in results_dict:
time.sleep(0.1)
frames = results_dict[hash_index]
# dont block access to it anymore
del results_dict[hash_index]

@nadermx
Copy link
Owner

nadermx commented Dec 22, 2023

Are both of you trying to convert to mp4? Can I see the full command?

@LiveNL
Copy link

LiveNL commented Dec 22, 2023

I am. For example with:

python -m backgroundremover.cmd.cli -i "short.mp4" -tv -o "output.mov"

I've tried .mov files as input as well, by coverting .mp4's first:

ffmpeg -i short.mp4 -f mov short.mov

In this case the script runs more smoothly, but in the delivers a video that isn't openable by quicktime (I'm on macOS, m1). It does open in DaVinci Resolve, but just shows a sort of distored/damaged input video. This is another issue, but just FYI.

@nadermx
Copy link
Owner

nadermx commented Dec 22, 2023 via email

@1ncoQAQ
Copy link
Author

1ncoQAQ commented Dec 22, 2023

I think I figured it out. The input video is shot with my smartphone. Maybe my phone uses a different encoding standard, which causes some frames can not be recognized by backgroundremover, so the process stuck.
To fix this, I simply convert my video using ffmpeg once:
ffmpeg -i originalVideo.mp4 fixedVideo.mp4
Then use backgroundremover to deal with the fixed video, this time the program works.
Thank you for the reply Jordi! you inspired me to preprocess the video first before throwing it into backgroundremover.
Maybe we can add this preprocessing to the workflow to make sure backgroundremover can handle the video correctly?

@nadermx
Copy link
Owner

nadermx commented Dec 22, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants