AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-106927

Dmitry Grigoryev's questions

Martin Hope
Dmitry Grigoryev
Asked: 2024-04-13 13:45:37 +0800 CST

如何从 m4a 字幕流中提取歌词?

  • 6

我有以下.m4a 文件ffprobe(在 Debian 12.1 上)报告:

  Stream #0:1[0x2](eng): Data: bin_data (text / 0x74786574), 0 kb/s
    Metadata:
      handler_name    : SubtitleHandler
Unsupported codec with id 98314 for input stream 1

这些是歌词吗?如果是,我该如何将它们提取为纯文本?

debian
  • 1 个回答
  • 21 Views
Martin Hope
Dmitry Grigoryev
Asked: 2024-04-01 01:16:07 +0800 CST

快速测试音频文件比特率

  • 5

我正在尝试使用 shell 脚本识别音频收藏中具有高/低比特率的文件。做起来file test.mp3非常快:

$time file test.mp3 
test.mp3: Audio file with ID3 version 2.3.0, contains: MPEG ADTS, layer III, v1, 128 kbps, 44.1 kHz, Stereo

real    0m0.027s

但是,file不显示 .m4a 文件的比特率:

$time file test.m4a 
test.m4a: ISO Media, Apple iTunes ALAC/AAC-LC (.M4A) Audio

real    0m0.056s

我尝试使用exiftooland ffprobe,但它们似乎至少慢了 10 倍:

$time exiftool test.m4a 
Avg Bitrate                     : 131 kbps

real    0m0.532s
$time ffprobe test.m4a 
  Stream #0:0[0x1](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 130 kb/s (default)

real    0m0.621s

这大约只有 100 个文件/分钟,相当慢。有没有更快的方法来查找 m4a 文件的比特率?据我了解,ffprobe检查流数据而不是标签,因此它比file. 只要速度快,我就可以接受不太精确的比特率值。

shell-script
  • 1 个回答
  • 25 Views
Martin Hope
Dmitry Grigoryev
Asked: 2022-03-16 06:51:16 +0800 CST

在 GUI 中识别的文件类型,但不是在命令行中

  • 3

我最近意识到file在 Debian Bullseye 上无法识别我正在处理的一些文件格式,告诉我它们只是 ZIP 文件:

user@host:~ $ file file.docx   # Correct, not a regular ZIP file
file.docx: Microsoft Word 2007+

user@host:~ $ file file.key    # Incorrect, also not a regular ZIP file
file.key: Zip archive data, at least v2.0 to extract

但是,如果我查看带有 的文件pcmanfm,我会看到文件类型被正确识别:

"file.docx" (50.5kB) Word 2007 document
"file.key" (10.4MB) Apple Keynote 5 presentation

是否可以告诉file使用与使用相同的魔术文件pcmanfm,或者以某种方式更新默认值/etc/magic以file了解流行的文档格式?

debian file-types
  • 1 个回答
  • 175 Views
Martin Hope
Dmitry Grigoryev
Asked: 2022-02-01 12:22:14 +0800 CST

如何查找给定字符编码的语言环境名称?

  • 2

的手册页setlocale似乎说语言代码和字符编码名称足以设置适当的语言环境:

语言环境名称通常采用语言[_territory][.codeset][@modifier] 形式,其中语言是 ISO 639 语言代码,地区是 ISO 3166 国家代码,代码集是字符集或编码标识符,如 ISO- 8859-1 或 UTF-8。

但是,一个快速测试表明,只有语言环境名称的“修饰符”部分是可选的:

void tryLocale(const char * locid)
{
    char * result = std::setlocale(LC_CTYPE, locid);
    std::cout << locid << " = " << (result ? result : "fail") << std::endl;
}

int main()
{
    tryLocale("de");           // de = fail
    tryLocale("de_DE");        // de_DE = fail
    tryLocale("de_DE.CP1252"); // de_DE.CP1252 = de_DE.CP1252
    tryLocale("de.CP1252");    // de.CP1252 = fail
    tryLocale(".CP1252");      // .CP1252 = fail
}

我的问题是我只知道所需的编码名称(例如ISO-8859-1),我可能会想出语言代码(例如en)。我不知道如何找到一个合适的国家名称(例如US),而且我对一个国家也不感兴趣:我只希望tolower我的应用程序中的功能使用正确的代码页。

character-encoding locale
  • 1 个回答
  • 185 Views
Martin Hope
Dmitry Grigoryev
Asked: 2021-11-10 06:15:31 +0800 CST

sudo 在哪里隐藏我的根的 .Xauthority 数据?

  • 3

我刚刚注意到有关如何sudo处理.Xauthority文件的一些特殊情况:

sudo xauth add $(xauth list | tail -1)

user@server: sudo xauth info
Authority file:       /root/.xauthYZ21Nt
File new:             no
File locked:          no
Number of entries:    1
Changes honored:      yes
Changes made:         no
Current input:        (argv):1

user@server:  sudo xauth info
Authority file:       /root/.xauth3BFy5d
File new:             no
File locked:          no
Number of entries:    1
Changes honored:      yes
Changes made:         no
Current input:        (argv):1

user@server:  sudo xauth list
server/unix:10  MIT-MAGIC-COOKIE-1  c922ab48defdf43b1092dffb86c06eed

user@server: sudo ls -la /root | grep auth
-rw-r--r--  1 root root    0 Nov  9 14:40 .Xauthority
-rw-------  1 root root   57 Nov  9 15:23 .xauthsrxzxl

user@server:  pkexec xauth info
Authority file:       /root/.Xauthority
File new:             no
File locked:          no
Number of entries:    0
Changes honored:      yes
Changes made:         no
Current input:        (argv):1

因此,$XAUTHORITY每个 new 的 value 都是不同的sudo,它指向一个临时文件,该文件在sudo 退出时会消失。正因为如此,最后一个命令(它使用pkexec而不是sudo并期望它在 中/root/.Xauthority)无法看到 cookie。例如,sudo gedit运行良好,但pkexec env DISPLAY=$DISPLAY gedit失败。

为什么要以如此复杂的方式完成,数据存储在哪里,更重要的是,我如何访问.Xauthority数据pkexec?

debian sudo
  • 5 个回答
  • 603 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve