File size: 2,227 Bytes
9b0d0c6
 
 
 
 
 
 
 
 
 
 
bb80cd7
9b0d0c6
 
 
 
 
 
 
 
 
 
 
cd22072
 
9b0d0c6
af141d7
fb4eaa3
9b0d0c6
c2e0206
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import subprocess
import time
import os
from threading import Thread
from datetime import datetime
import requests
def start_livestream(video_path):
    ffmpeg_command = [
        "ffmpeg",
        "-re",
        "-stream_loop", "-1",
        "-i", video_path,
        "-c:v", "libx264",
        "-preset", "veryfast",
        "-maxrate", "3000k",
        "-bufsize", "6000k",
        "-pix_fmt", "yuv420p",  # Đảm bảo định dạng pixel được hỗ trợ
        "-vf", "format=yuv420p",  # Chuyển đổi video đầu vào sang yuv420p
        "-g", "50",
        "-c:a", "aac",
        "-b:a", "128k",
        "-ar", "44100",
        "-f", "flv",
        f"rtmp://push-rtmp-l11-va01.tiktokcdn.com/game/stream-2998439968409649252?c=VN&expire=1731169140&sign=f7af545f97895aa660e94be37b362e0d"
        #f"rtmp://a.rtmp.youtube.com/live2/m65r-k6dr-u7ba-mux1-ffzx"
    ]
    print('beginning')
    return subprocess.run(ffmpeg_command)
if __name__ == "__main__":
    start_livestream('https://video-weaver.lax03.hls.ttvnw.net/v1/playlist/CsUGTrOxB_4cq5fjMKah3P0_hTHkv35tbro2xTzedhK6ch2-sU7RGVoGnhjmx80mEkK3xE04En6mDtGCxhcEDuXPM1BFD3oSQ1Em49s633ks0E1UwMJu7u9LO6D3HYinZ5kKTift3kALal3yAkwj8C-kdens3P_59mrgdkirU5AB3PVSw4Sxg6KLu1Dr751aHUWb6zHdQp652TwIP3j-IOAaGBOQdXZjPGyNNXkiKT2SmZB4hqQWGh3MacTohpLKDfVMHb2_KyL0kZ9pk_1kHoTpxyBvY6h5IYcFsQ1iQLOJG5RN28UXyux3PHkLURF2XKr_vGtN3ZfXTVcKyEQOUmeZAshpizCU-MGVuPTWky0tNuM9SDGGQll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