Linux: export and editor audio fail with EINVAL under comma-decimal locales (resampler-open)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- rust
- Lĩnh vực
- audio-video-rtc
Hướng nghiên cứu
Start in crates/audio/src/streaming.rs at the resampler configuration using filter_size and cutoff. Reproduce the failure with a comma-decimal locale, then verify the numeric option handling against the bundled FFmpeg libraries. Done means Studio export and editor system-audio preview work under pt_BR.UTF-8 while continuing to work under LC_NUMERIC=C.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
On Linux with a locale that uses a comma as the decimal separator (pt_BR.UTF-8), every Studio recording fails to export:
Failed to export recording: Failed to load media: MultipleSegments 0 System Audio / resampler-open / Argumento inválido / next=0
("Argumento inválido" is the localized EINVAL.) Editor preview is also silent, and the log repeats:
WARN cap_editor::segments: Failed to load system audio track; continuing without it error=MultipleSegments 0 System Audio / resampler-open / Argumento inválido / next=0
I expected the export to succeed and the preview to play with system audio. The recorded system_audio.m4a is valid (AAC mono 48 kHz, plays fine in ffmpeg).
Root cause: crates/audio/src/streaming.rs configures the resampler with string options:
options.set("filter_size", "128");
options.set("cutoff", "0.97");
av_opt_set_dict parses "0.97" with strtod, which follows LC_NUMERIC. Under pt_BR the decimal separator is ,, so parsing fails and resampling::Context::get_with
returns EINVAL.
Suggested fix: set numeric options numerically (av_opt_set_double(ptr, "cutoff", 0.97, 0), av_opt_set_int(ptr, "filter_size", 128, 0)) before swr_init, or force
LC_NUMERIC=C at startup.
Workaround: launch Cap with LC_NUMERIC=C (e.g. Exec=env LC_NUMERIC=C Cap in a user .desktop override). Export and editor audio then work.
Reproduction
- On Linux, set
LANG=pt_BR.UTF-8/LC_NUMERIC=pt_BR.UTF-8(any comma-decimal locale). - Record a Studio recording with system audio.
- Open it in the editor and press play: no system audio.
- Export to MP4: the error above.
Minimal repro against Cap's bundled FFmpeg:
#include <locale.h>
#include <stdio.h>
#include <libavutil/channel_layout.h>
#include <libavutil/opt.h>
#include <libswresample/swresample.h>
int main(void) {
setlocale(LC_ALL, "");
AVChannelLayout mono = AV_CHANNEL_LAYOUT_MONO;
SwrContext *s = NULL;
swr_alloc_set_opts2(&s, &mono, AV_SAMPLE_FMT_FLT, 48000,
&mono, AV_SAMPLE_FMT_FLTP, 48000, 0, NULL);
printf("cutoff=%d\n", av_opt_set(s, "cutoff", "0.97", 0));
swr_free(&s);
}
$ cc repro.c -L/usr/lib/cap -l:libswresample.so.5 -l:libavutil.so.59 -Wl,-rpath,/usr/lib/cap
$ LC_ALL=pt_BR.UTF-8 ./a.out
[Eval] Invalid chars '.97' at the end of expression '0.97'
[SWR] Unable to parse option value "0.97"
cutoff=-22
$ LC_NUMERIC=C ./a.out
cutoff=0
Additional Context
- Cap version: 0.6.0 (
cap-binfrom the AUR) - Operating system, version: CachyOS (Arch Linux), kernel 7.2.3, Wayland / Hyprland
- Device (optional): AMD Ryzen 5 5600G, AMD Radeon RX 7600
Logs (~/.local/share/so.cap.desktop/logs/cap-desktop.log.2026-09-26):
2026-09-26T13:53:58.323416Z WARN cap_desktop_lib: System audio failed to load; returning empty waveform error=MultipleSegments 0 System Audio / resampler-open / Argumento
inválido / next=0
2026-09-26T13:54:05.551013Z WARN cap_editor::segments: Failed to load system audio track; continuing without it error=MultipleSegments 0 System Audio / resampler-open /
Argumento inválido / next=0
2026-09-26T14:04:31.970715Z WARN cap_desktop_lib: System audio failed to load; returning empty waveform error=MultipleSegments 0 System Audio / resampler-open / Argumento
inválido / next=0
2026-09-26T14:07:02.119598Z WARN cap_editor::segments: Failed to load system audio track; continuing without it error=MultipleSegments 0 System Audio / resampler-open /
Argumento inválido / next=0
Export diagnostic (cap-desktop.log.diagnostic-current.jsonl), 4 of 4 MP4 export attempts returned this:
{"time":"2026-09-26T14:14:11Z","app":"0.6.0","os":"linux","operation":"export_mp4","outcome":"returned_error","elapsedMs":4394,"fields":{"requested_fps":60,"requested_width":1
920,"requested_height":1080,"source_width":2560,"source_height":1440,"source_segments":1,"clips":1,"captions":false,"streaming_audio":false}}
- Ngôn ngữ chính
- Rust
- Star
- 22.8k
- Fork
- 2k
- Merge trung bình
- 12 giờ 41 phút
- Pull request đã merge (30 ngày)
- 84
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của CapSoftware/Cap
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
CapSoftware/Cap#2305 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
CapSoftware/Cap#1714 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
CapSoftware/Cap#2367 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 32/100
CapSoftware/Cap#2366 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
CapSoftware/Cap#2365 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của CapSoftware/Cap
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
area: cli bug priority: P2 ready-for-agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày