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

High speed cameras generate warning about unused codec option #588

Open
alexpiet opened this issue Jul 3, 2024 · 16 comments
Open

High speed cameras generate warning about unused codec option #588

alexpiet opened this issue Jul 3, 2024 · 16 comments
Assignees

Comments

@alexpiet
Copy link
Collaborator

alexpiet commented Jul 3, 2024

02:10:24 PM:INFO:Foraging:Foraging.py:log_subprocess_output:line 4288:BONSAI: [out#0/avi @ 0000013ff6d2af00] Codec AVOption crf (Select the quality for constant quality mode) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.

I checked, and the logs include this warning before the recent addition of the -v 24 verbose option, it was just getting buried in other information. This message appears twice, once for each camera. It appears whether I pressed "preview" or "record"

This is the codec in Settings_box1.csv
codec,-vcodec h264_nvenc -crf 23 -preset fast -b:v 50M

I dont know what -crf 23 does, or if it matters. @XX-Yin @ZhixiaoSu

@alexpiet
Copy link
Collaborator Author

@ZhixiaoSu @XX-Yin Can you investigate this?

@ZhixiaoSu
Copy link
Collaborator

ZhixiaoSu commented Jul 18, 2024

In cpu compression, -crf 23 controls the compression level, the larger the number, the higher the compression. But as we switched to gpu compression, we should change the flag to -rc vbr -cq 23. I got the same error when using -crf locally.

@ZhixiaoSu
Copy link
Collaborator

I attempted to test different codecs, but the codec in video writer doesn't seem to update according to the one in box settings. @XX-Yin Is there a different location I should check to update the codec?

@XX-Yin
Copy link
Collaborator

XX-Yin commented Jul 19, 2024

There are four boxes. I assume that you changed the right Settings_box#.csv?

@alexpiet
Copy link
Collaborator Author

Might be obvious - but you need to close the GUI after changing the codec, you can't just start/stop the camera.

@ZhixiaoSu
Copy link
Collaborator

ZhixiaoSu commented Jul 19, 2024

@XX-Yin Yes, I change the one in setting folder. For 446, each computer only has one settings file, so it's hard to be wrong. And, yes, @alexpiet I restarted the GUI together with Bonsai and check the codecs after restarting. The parameter I tested with was bitrate, changing the number to 25M in csv file didn't change the one in bonsai.

@ZhixiaoSu
Copy link
Collaborator

ZhixiaoSu commented Jul 19, 2024

I just figured out why: since the cameras are in restart loggers, the codec doesn’t update until we trigger the camera. After triggering, the codec gets updated.

@XX-Yin
Copy link
Collaborator

XX-Yin commented Jul 19, 2024 via email

@ZhixiaoSu
Copy link
Collaborator

I tested '-rc vbr -cq 23' on 6A and 6B, it worked well without warnings. I'll check the video quality of 6A, which still has this codec now. If it looks ok, let's update all the codecs.

@XX-Yin
Copy link
Collaborator

XX-Yin commented Jul 22, 2024

Hi @ZhixiaoSu, looks great! Can you also check if the video quality/size changes with the -cq value?

@ZhixiaoSu
Copy link
Collaborator

It should in theory, as it has similar functions as -crf in cpu codec. Let me check it with a real mouse there.

@ZhixiaoSu
Copy link
Collaborator

ZhixiaoSu commented Jul 30, 2024

Videos look ok, @mlee10201 will help update the codecs this week (week of 7/29).

@alexpiet alexpiet closed this as completed Aug 6, 2024
@alexpiet alexpiet reopened this Aug 6, 2024
@alexpiet
Copy link
Collaborator Author

alexpiet commented Aug 6, 2024

We should make a PR to change the settings template file so all the rigs use the same codec. @mlee10201 share the final codec you used.

@galenlynch
Copy link

Is this the same codec as the one Bruno was recommending?

@mlee10201
Copy link

codec,-vcodec h264_nvenc -rc vbr -cq 23 -preset fast -b:v 50M -v 24
this is what it's been updated to

@ZhixiaoSu
Copy link
Collaborator

Let’s also include sound attenuation in the settings. I can add it this week.

This was referenced Aug 8, 2024
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

5 participants