> For the complete documentation index, see [llms.txt](https://getsquish.gitbook.io/squish/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://getsquish.gitbook.io/squish/th/getting-started/quickstart-cli.md).

# เริ่มต้นเร็ว: CLI

**ให้ AI เข้าถึงวิดีโอแบบสุ่มได้** Squish CLI แปลงวิดีโอให้เป็นชีตติดต่อที่มีประทับเวลา — เป็นตารางของเฟรม โดยแต่ละช่องมีโค้ดเวลาสัมบูรณ์ของตัวเอง — ทั้งหมดทำบนเครื่องของคุณเอง ไม่มีการอัปโหลดอะไรเลย และทุกความหนาแน่นใช้ฟรี

## ข้อกำหนด

* **Node ตั้งแต่ 20 ขึ้นไป**
* **`ffmpeg` + `ffprobe` อยู่ใน PATH**
  * macOS: `brew install ffmpeg`
  * Ubuntu: `sudo apt-get install ffmpeg`

## ชีตแรก

ไม่ต้องติดตั้ง — รันตรงจาก npm ได้เลย:

```bash
npx -y @getsquish/squish clip.mov
```

หรือติดตั้งแบบใช้งานได้ทั่วระบบ:

```bash
npm install -g @getsquish/squish
squish clip.mov
```

## สิ่งที่ถูกบันทึกลงดิสก์

ชีตจะถูกวางไว้ข้างไฟล์อินพุตเป็น `clip.sheet-1.jpg` (รูปแบบ: `<basename>.sheet-N.jpg`) — ตารางเฟรมที่มีโค้ดเวลา ความหนาแน่นเริ่มต้น 3×3 ช่วยให้เห็น *ว่า* เกิดอะไรขึ้น; `4x4`–`6x6` ช่วยให้เห็น *ว่า* ทำอย่างไร `--out <dir>` เป็นตัวเลือกปลายทาง

ส่งชีตนี้ให้โมเดลมองภาพใดก็ได้: ช่องต่าง ๆ เรียงตามลำดับเวลา จากซ้าย→ขวา บน→ล่าง และทุกช่องมีโค้ดเวลาสัมบูรณ์ของเฟรมที่แสดงอยู่

## ผลลัพธ์ที่เครื่องอ่านได้: `--json`

เมื่อใช้ `--json`แล้ว stdout จะเป็นอ็อบเจ็กต์เดียว (สัญญาที่ล็อกไว้ — ให้ parse `สัญญา` เพื่อตรวจจับการเปลี่ยนแปลงที่ทำให้ใช้งานเดิมไม่ได้):

```json
{
  "input": "/abs/path/clip.mov",
  "duration": 20.275,
  "frames": 9,
  "sheets": 1,
  "files": ["/abs/path/clip.sheet-1.jpg"],
  "warnings": [],
  "contract": "squish-cli-v0"
}
```

สถานะออก `0` สำเร็จ · `1` ล้มเหลว (ข้อความอยู่ใน stderr) เฟรมชั่วคราวจะถูกล้างออกเสมอ

## ซูมเข้าไปในช่วง

`--start` / `--end` รับค่าเป็นวินาที (`90`) หรือเป็นโค้ดเวลาตรงตามที่ประทับไว้บนชีต (`1:30`, `1:07.3`) แล้วจำกัดการรันให้อยู่ในช่วงนั้น:

```bash
squish clip.mov --start 1:00 --end 1:30 --density 5x5
```

**โค้ดเวลาจะอ้างอิงแบบสัมบูรณ์กับวิดีโอต้นฉบับเสมอ**, ดังนั้นคุณจึงซูมซ้ำได้: ภาพรวม → เลือกช่วง → รันใหม่ด้วย `--start`/`--end` → โค้ดเวลาที่ละเอียดขึ้น → เจาะต่ออีกครั้ง ช่วงสั้นจะประทับโค้ดเวลาแบบต่ำกว่าหนึ่งวินาที (`1:07.3`) เพื่อให้ช่องที่อยู่ติดกันยังแยกจากกันได้ การรันแบบกำหนดช่วงยังจะแสดงซ้ำ `"window": { "start": …, "end": … }` (ขอบเขตที่คำนวณแล้ว หน่วยเป็นวินาที) ใน `--json` ผลลัพธ์ — คีย์นี้จะไม่มีเมื่อไม่ได้ขอช่วงเวลา

## ถัดไป

* [ลูปการนำทาง](/squish/th/the-primitive/the-navigation-loop.md) — วิธีที่เอเจนต์เชื่อม ภาพรวม → ซูม → ซูม เพื่อหาคำตอบพร้อมหลักฐาน แทนการเปิดดูคลิปซ้ำ
* [เอกสารอ้างอิง CLI](/squish/th/reference/cli.md) — ทุกแฟลก, รหัสออก, และสัญญา JSON แบบเต็ม


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://getsquish.gitbook.io/squish/th/getting-started/quickstart-cli.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
