mcpField
L
lecture-notes

lecture-notes

github.com/emmsixx生产力571 次安装6 周前更新
代码仓库

关于 lecture-notes

将课程材料整理为适用于 Obsidian 的结构化 Markdown 复习笔记。音视频采用先转录再生成笔记的流程,并规定公式、定义、例题和链接的格式。

主要功能

  1. 01生成适用于 Obsidian 的 Markdown 笔记
  2. 02音视频先转录再整理
  3. 03提供 OpenRouter 音频转录指引
  4. 04结构化定义与考试重点标注
  5. 05不同主题拆分为独立文件

适用场景

  1. 01将课程录音整理为复习笔记
  2. 02结合讲课转录与幻灯片或 PDF
  3. 03将多主题材料整理为独立文件

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/emmsixx/skills --skill lecture-notes

安装后在 Claude Code 中输入/lecture-notes确认已加载。

详细介绍

课堂笔记技能

将课堂材料整理为结构化、适合备考的 Markdown 笔记,供 Obsidian 使用。

音频和视频输入

当源材料是音频或视频文件时,务必先在本地生成转录文本,并将该转录文本作为生成笔记的主要输入。

必需工作流
  1. 如果输入是音频,使用 OpenRouter,通过 openai/gpt-4o-audio-mini 和 input_audio 格式进行转录。
  2. 如果输入是视频,先用 ffmpeg 提取单独的音频文件,再通过 OpenRouter 转录提取出的音频。
  3. 将转录文本保存为本地纯文本文件,并在后续课堂笔记工作流中使用该文件。
  4. 如有用,也可以将原始 JSON 响应保存到本地,但 .txt 转录文本才是生成笔记的规范来源。
OpenRouter 音频转录

使用音频或视频转录前,确保环境中已定义 OPENROUTER_API_KEY。

使用 OpenRouter 的聊天补全 API 和多模态 input_audio。提示词应明确要求逐字转录,并尽量少做整理。

AUDIO_BASE64=$(base64 < "Lecture 05.audio.wav" | tr -d '\n')

curl https://openrouter.ai/api/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -d "{\n    \"model\": \"openai/gpt-4o-audio-mini\",\n    \"messages\": [\n      {\n        \"role\": \"user\",\n        \"content\": [\n          {\n            \"type\": \"text\",\n            \"text\": \"Transcribe this lecture audio as plain text. Keep the wording faithful to the speaker, preserve important structure, and do not summarize.\"\n          },\n          {\n            \"type\": \"input_audio\",\n            \"input_audio\": {\n              \"data\": \"$AUDIO_BASE64\",\n              \"format\": \"wav\"\n            }\n          }\n        ]\n      }\n    ]\n  }"

实际使用此技能时,先保存 JSON 响应,再将转录文本提取到纯文本文件中:

AUDIO_BASE64=$(base64 < "Lecture 05.audio.wav" | tr -d '\n')

curl https://openrouter.ai/api/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -d "{\n    \"model\": \"openai/gpt-4o-audio-mini\",\n    \"messages\": [\n      {\n        \"role\": \"user\",\n        \"content\": [\n          {\n            \"type\": \"text\",\n            \"text\": \"Transcribe this lecture audio as plain text. Keep the wording faithful to the speaker, preserve important structure, and do not summarize. Return only the transcript text.\"\n          },\n          {\n            \"type\": \"input_audio\",\n            \"input_audio\": {\n              \"data\": \"$AUDIO_BASE64\",\n              \"format\": \"wav\"\n            }\n          }\n        ]\n      }\n    ]\n  }" \
  > "Lecture 05.transcript.response.json"

jq -r '.choices[0].message.content // (.choices[0].message.content[]? | select(.type == "text") | .text)' \
  "Lecture 05.transcript.response.json" > "Lecture 05.transcript.txt"
建议的本地文件输出

对于 Lecture 05.mp4 或 Lecture 05.m4a 这样的输入文件,请使用可预测的名称将衍生文件保存在同一目录下:

  • Lecture 05.audio.wav,用于从视频提取的音频,或用于上传前标准化的音频
  • Lecture 05.transcript.response.json,用于保存 OpenRouter API 响应
  • Lecture 05.transcript.txt,用于生成笔记的纯文本转录稿
视频转音频提取

转录前使用 ffmpeg 从视频中提取音频。安全的默认命令是:

ffmpeg -i "Lecture 05.mp4" -vn -ac 1 -ar 16000 -c:a pcm_s16le "Lecture 05.audio.wav"

如果源文件本身是音频,但格式不便使用,请先将其标准化为 .wav,再进行 Base64 编码和上传。

转录稿处理规则
  • 始终根据本地保存的转录文件生成笔记,不要直接使用原始媒体文件。
  • 如果用户还提供了幻灯片、PDF 或其他课堂材料,生成笔记时应将这些材料与转录稿结合起来。
  • 保留重要的口述结构,例如章节过渡、定义、定理陈述、示例和反复提及的考试提示。
  • 如果转录稿明显嘈杂或不完整,应在最终笔记中说明不确定之处,而不是悄悄编造缺失内容。
  • 如果本地已存在同一媒体文件的转录稿,除非用户明确要求重新转录,否则应重复使用。

输出格式

将所有笔记放在围栏代码块中输出。内容涉及多个章节或不同主题时,请分别创建文件。

文件命名

Chapter X - Title.md 或 Unit X - Title.md

文档结构
---
course: [Course name if known]
lecture: [Lecture number/title]
date: [Date if provided]
tags: [relevant, topic, tags]
---

# Title
Brief overview connecting to previous material when applicable.

## Key Concepts
Bulleted summary of the most important takeaways.

## [Content Sections]
Organized by topic from the source material.

## Definitions
New terms introduced in this lecture.

## [Additional Sections as Needed]
Examples, proofs, diagrams, etc.

格式规则

标题

标题后不要留空行。内容应紧接着出现在下一行:

## Section Title
Content starts here directly below the heading.
数学和公式

使用 LaTeX,以 $...$(行内)或 $$...$$(块级)格式书写:

The quadratic formula is $x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$.

$$
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
$$
脚注

使用 Markdown 脚注补充信息。不要使用引用:

This concept was introduced in 1905[^1].

[^1]: Additional context or clarification here.
考试重点提示框

使用 Obsidian 提示框标记关键信息:

> [!important] Exam Alert
> This formula is frequently tested.

> [!note] Remember
> Supplementary context or tips.

> [!example] Worked Example
> Step-by-step demonstration.

> [!warning] Common Mistake
> Students often confuse X with Y.

> [!definition] Term
> Formal definition here.
Wiki 链接

使用 [[双层方括号]] 链接相关概念:

This relates to [[Chapter 2 - Thermodynamics#Entropy]].

内容指南

完整性

记录源材料中的所有信息,尤其是:

  • 公式和方程
  • 定义和定理
  • 示例和解题过程
  • 图表(必要时用文字或 ASCII 描述或重现)
  • 讲师强调为重要的内容
定义部分

始终包含 ## Definitions 部分。每个术语的格式如下:

## Definitions
**Term**
Precise definition immediately below.

**Another Term**
Its definition here.
概念联系

尽可能关联之前的课程或相关概念:

## Key Concepts
- Builds on [[Chapter 3 - Kinematics]] by introducing forces
- Extends the velocity equations to include acceleration
示例

保留源材料中的所有示例。使用示例提示框格式:

> [!example] Finding the Derivative
> Given $f(x) = x^3 + 2x$, find $f'(x)$.
>
> **Solution:**
> $$f'(x) = 3x^2 + 2$$

多个文件

当源材料涵盖多个不同章节或单元时,将每个章节或单元分别输出为代码块,并使用清晰的文件名:

```markdown

---
course: Physics 101
...
```
```markdown

---
course: Physics 101
...
```

评论

支持 Markdown