Onnuiko
AV Dedicator (VIP)
หื่นมีศิลปะ
 
ออฟไลน์
กระทู้: 73
|
 |
« ตอบ #10 เมื่อ: มกราคม 31, 2025, 03:38:36 AM » |
|
ล่าสุดน่าจะดีสุดในบรรดาของฟรีแล้ว แต่ก็ห่วยแตกอยู่ดี ยอมเสียตังสามร้อยต่อเดือนคุ้มกว่า  สอบถามหน่อยครับ ใช้เว็บไหนหรอครับอยากลองดูบ้างครับ ] มันก็ใช้OpenAI Whisperเหมือนเดิมแต่มันรันผ่านเซิร์ฟของgoogle ซึ่งมันจะไวมากกว่าทำบนคอมที่สเปคการ์ดจอไม่แรง https://github.com/openai/whisperhttps://www.youtube.com/watch?v=wT34nynJYjYแต่AIของตัวเสียตังกระทู้บนผมว่ามันแปลแม่นกว่า
|
|
|
|
« แก้ไขครั้งสุดท้าย: มกราคม 31, 2025, 03:41:48 AM โดย Onnuiko »
|
บันทึกการเข้า
|
|
|
|
Onnuiko
AV Dedicator (VIP)
หื่นมีศิลปะ
 
ออฟไลน์
กระทู้: 73
|
 |
« ตอบ #11 เมื่อ: มกราคม 31, 2025, 12:16:17 PM » |
|
ลองดูกระทู้ผมนะครับ ทุกวันนี้ผมก็ยังใช้อยู่เรื่อยๆ ถ้าหนังใหม่ๆไม่มีคนแปลมันก็ตรงดีครับ แต่ไม่มาก อยู่ที่ว่านักแสดงพูดชัดเจนไหม และไม่ต้องมานั่งแก้ TF ด้วย หลังแปลก็ใช้ได้ทันที มันจะแยกออกมาให้ 2 ไฟล์ ไฟล์ซับต้นฉบับ กับ ซับภาษาที่เราเลือก https://www.avcollectors.com/board/index.php?topic=241256.0ได้ลองแล้วถือว่าใช้ได้เลยแปลได้เกิบเท่าOpenAI Whisper model ใหญ่สุด ข้อดีคือแปลไวสุดๆและไม่ต้องมาแปลงเป็นไทยอีกรอบมีให้ครบเลย แต่เสียดายอัพเดทล่าสุดแค่ปี23
|
|
|
|
|
บันทึกการเข้า
|
|
|
|
pictureuploadsex
AV Dedicator (VIP)
วุฒิสมาชิกเอวี
 
ออฟไลน์
กระทู้: 418
rejuvenation massage
|
 |
« ตอบ #12 เมื่อ: พฤษภาคม 31, 2026, 10:21:25 PM » |
|
...
|
|
|
|
« แก้ไขครั้งสุดท้าย: มิถุนายน 24, 2026, 06:21:31 PM โดย pictureuploadsex »
|
บันทึกการเข้า
|
|
|
|
pictureuploadsex
AV Dedicator (VIP)
วุฒิสมาชิกเอวี
 
ออฟไลน์
กระทู้: 418
rejuvenation massage
|
 |
« ตอบ #13 เมื่อ: มิถุนายน 01, 2026, 12:05:17 AM » |
|
...
|
|
|
|
« แก้ไขครั้งสุดท้าย: มิถุนายน 24, 2026, 06:20:46 PM โดย pictureuploadsex »
|
บันทึกการเข้า
|
|
|
|
pictureuploadsex
AV Dedicator (VIP)
วุฒิสมาชิกเอวี
 
ออฟไลน์
กระทู้: 418
rejuvenation massage
|
 |
« ตอบ #14 เมื่อ: มิถุนายน 24, 2026, 06:07:03 PM » |
|
ffmpeg -i untitled.mp4 -vn -ar 16000 -ac 1 untitled.flac-i คือ input-vn คือ video none-ar คือ audio rate-ac คือ audio channel.jpg)
|
|
|
|
« แก้ไขครั้งสุดท้าย: วันนี้ เวลา 12:34:42 PM โดย pictureuploadsex »
|
บันทึกการเข้า
|
|
|
|
pictureuploadsex
AV Dedicator (VIP)
วุฒิสมาชิกเอวี
 
ออฟไลน์
กระทู้: 418
rejuvenation massage
|
 |
« ตอบ #15 เมื่อ: มิถุนายน 24, 2026, 06:07:09 PM » |
|
|
|
|
|
« แก้ไขครั้งสุดท้าย: วันนี้ เวลา 12:34:57 PM โดย pictureuploadsex »
|
บันทึกการเข้า
|
|
|
|
pictureuploadsex
AV Dedicator (VIP)
วุฒิสมาชิกเอวี
 
ออฟไลน์
กระทู้: 418
rejuvenation massage
|
 |
« ตอบ #16 เมื่อ: มิถุนายน 24, 2026, 06:07:15 PM » |
|
|
|
|
|
« แก้ไขครั้งสุดท้าย: วันนี้ เวลา 12:35:09 PM โดย pictureuploadsex »
|
บันทึกการเข้า
|
|
|
|
pictureuploadsex
AV Dedicator (VIP)
วุฒิสมาชิกเอวี
 
ออฟไลน์
กระทู้: 418
rejuvenation massage
|
 |
« ตอบ #17 เมื่อ: มิถุนายน 24, 2026, 06:07:21 PM » |
|
ถอดซับ ### เซลล์ 1 ###!nvidia-smi### เซลล์ 2 ###!pip install faster-whisper -q### เซลล์ 3 ###import os
from faster_whisper import WhisperModel
print("Loading model...")
model = WhisperModel( "large-v3", device="cuda", compute_type="float16" )### เซลล์ 4 ###from google.colab import drive
drive.mount("/content/drive", force_remount=True)### เซลล์ 5 ###audio_file = "/content/drive/MyDrive/Colab Notebooks/untitled.flac"
srt_file = os.path.splitext(audio_file)[0] + ".srt"### เซลล์ 6 ###print("Start transcribing...")
segments, info = model.transcribe( audio_file, language="ja", condition_on_previous_text=False, temperature=0, hallucination_silence_threshold=0.1, word_timestamps=True, beam_size=1 )
print("Writing srt...")
def fmt(t): h = int(t // 3600) m = int((t % 3600) // 60) s = int(t % 60) ms = int((t - int(t)) * 1000)
return f"{h:02}:{m:02}:{s:02},{ms:03}"
with open(srt_file, "w", encoding="utf-8") as f: i = 1
for segment in segments: if segment.words: first_word = segment.words[0] last_word = segment.words[-1]
start = first_word.start end = last_word.end else: start = segment.start end = segment.end
text = segment.text.strip()
if not text: continue
f.write(f"{i}\n") f.write(f"{fmt(start)} --> {fmt(end)}\n") f.write(f"{text}\n\n")
print( f"[{i}] " f"{fmt(start)} --> " f"{fmt(end)} " f"{text}" )
i += 1
print("Done") print("Saved:", srt_file)### เซลล์ 7 ###from google.colab import files
files.download(srt_file).jpg) .jpg) .jpg) .jpg) .jpg) .jpg)
|
|
|
|
« แก้ไขครั้งสุดท้าย: วันนี้ เวลา 01:23:22 PM โดย pictureuploadsex »
|
บันทึกการเข้า
|
|
|
|
pictureuploadsex
AV Dedicator (VIP)
วุฒิสมาชิกเอวี
 
ออฟไลน์
กระทู้: 418
rejuvenation massage
|
 |
« ตอบ #18 เมื่อ: มิถุนายน 24, 2026, 06:20:24 PM » |
|
แปลซับ ### เซลล์ 1 ###!pip install requests -q### เซลล์ 2 ###import os import re
import requests### เซลล์ 3 ###from google.colab import drive
drive.mount("/content/drive", force_remount=True)### เซลล์ 4 ###input_srt = "/content/drive/MyDrive/Colab Notebooks/untitled.srt"
srt_file = os.path.splitext(input_srt)[0] + "_thai.srt"### เซลล์ 5 ###OPENROUTER_API_KEY = "YOUR_API_KEY"
MODEL = "google/gemini-2.5-pro"
BATCH_SIZE = 5000### เซลล์ 6 ###with open(input_srt, "r", encoding="utf-8") as f: srt_text = f.read()
blocks = re.split(r"\n\s*\n", srt_text.strip())
subs = []
for block in blocks: lines = block.splitlines()
if len(lines) < 3: continue
subs.append( { "index": lines[0].strip(), "timestamp": lines[1].strip(), "text": " ".join( line.strip() for line in lines[2:] ), } )
print("Loaded:", len(subs), "blocks")### เซลล์ 7 ###from textwrap import dedent
translated_texts = {}
for start in range(0, len(subs), BATCH_SIZE):
batch = subs[start:start + BATCH_SIZE]
source_text = "\n".join( f"[{item['index']}] {item['text']}" for item in batch )
prompt = dedent(f"""
แปล ซับไตเติล เป็น ภาษาไทย
แปล ซับไตเติล เหมือน บทสนทนา
คำว่า "ฉัน" , "คุณ" เท่านั้น ห้าม คำว่า "ครับ", "คะ", "ค่ะ" เด็ดขาด
แปล ทุก บรรทัด ห้าม ข้าม บรรทัด ห้าม รวม บรรทัด ห้าม แยก บรรทัด
ห้าม คำ/พยัญชนะ/สระ ซ้ำ ๆๆๆ ติด ๆๆๆ มากกว่า 5 ครั้ง ใน บรรทัด เดียวกัน
{source_text}
""")
response = requests.post( "https://openrouter.ai/api/v1/chat/completions", headers={ "Authorization": f"Bearer {OPENROUTER_API_KEY}", "Content-Type": "application/json", }, json={ "model": MODEL, "messages": [ { "role": "user", "content": prompt, } ], "temperature": 0, "max_tokens": 200000, }, timeout=2000, )
print()
print( f"HTTP status: " f"{response.status_code} " f"{response.reason}" )
response.raise_for_status() result = response.json()
choice = result["choices"][0]
raw_content = ( result["choices"][0]["message"]["content"] .strip() )
print( f"Model: {result.get('model')}" )
print( f"Provider: {result.get('provider')}" )
print( f"Prompt tokens: " f"{result.get('usage', {}).get('prompt_tokens', 0)}" )
print( f"Completion tokens: " f"{result.get('usage', {}).get('completion_tokens', 0)}" )
print( f"Reasoning tokens: " f"{result.get('usage', {}) .get('completion_tokens_details', {}) .get('reasoning_tokens', 0)}" )
print( f"Finish reason: " f"{choice.get('finish_reason')}" )
print( f"Native finish reason: " f"{choice.get('native_finish_reason')}" )
match = re.findall( r"\[(\d+)\]\s*(.*?)(?=\[\d+\]|\Z)", raw_content, re.S, )
expected_count = len(batch) found_count = len(match)
print( f"Expected: {expected_count}, " f"Found: {found_count}" )
for index, text in match:
translated_texts[index] = ( text.strip() )
batch_start = start + 1
batch_end = min( start + BATCH_SIZE, len(subs), )
print( f"Done: {batch_start}-{batch_end}" )
print()
print( f"Raw response: " f"{' '.join(raw_content.split())}" )
print()### เซลล์ 8 ###output = []
for item in subs:
output.append(item["index"]) output.append(item["timestamp"])
output.append( translated_texts.get( item["index"], item["text"], ) )
output.append("")
with open( srt_file, "w", encoding="utf-8", ) as f: f.write("\n".join(output))
print("Saved:", srt_file)### เซลล์ 9 ###from google.colab import files
files.download(srt_file).jpg) .jpg) .jpg) .jpg) .jpg) .jpg)
|
|
|
|
« แก้ไขครั้งสุดท้าย: วันนี้ เวลา 01:23:48 PM โดย pictureuploadsex »
|
บันทึกการเข้า
|
|
|
|
|
|
|