EADST

Python: Get Frames from the Video with OpenCV

Python: Get Frames from the Video with OpenCV

import os
import cv2

video_path = "test.mp4"
video_name = os.path.basename(video_path)
cap = cv2.VideoCapture(video_path)
save_dir = os.path.join('./result', video_name)
success, frame = cap.read()
frame_index = 1
save_format = 'img{:06d}.jpg' 
while success:
    frame_path = os.path.join(save_dir, save_format.format(frame_index))
    cv2.imwrite(frame_path, frame)
    frame_index += 1
    success, frame = cap.read()
相关标签
About Me
XD
Goals determine what you are going to be.
Category
标签云
RGB Video Quantization GGML Docker PyTorch TensorFlow Template 报税 FP8 mmap Web Interview GoogLeNet Datetime tqdm 版权 Proxy printf Sklearn Bert NameSilo DeepSeek Pandas CC 算法题 Jetson Paddle Excel FP32 Crawler Baidu NLP Miniforge Card 域名 VGG-16 AI uWSGI Numpy OCR transformers Math CSV Knowledge SVR BeautifulSoup SAM Google PyCharm WAN 腾讯云 C++ Michelin Review Animate Cloudreve HuggingFace 财报 Bin ModelScope SPIE Streamlit Quantize Image2Text Attention Django Git Nginx ONNX Gemma Pytorch Conda LoRA Linux Llama Translation Markdown 多线程 BTC 继承 Diagram Github 阿里云 Password HaggingFace 关于博主 Augmentation OpenCV Vmess Claude ResNet-50 v0.dev SQL Heatmap IndexTTS2 Website API Food FP16 Safetensors 公式 FastAPI ChatGPT PIP hf PDB InvalidArgumentError XGBoost git Zip Anaconda Hungarian GIT torchinfo CLAP GPT4 LaTeX QWEN git-lfs CV Plotly Statistics Qwen Bipartite Bitcoin Data Qwen2.5 Plate JSON CTC Domain NLTK Pickle 音频 CEIR LLAMA 证件照 Shortcut Use FlashAttention logger WebCrawler LLM llama.cpp 多进程 COCO Windows Ptyhon Firewall VSCode Input Paper CUDA 飞书 搞笑 Clash VPN DeepStream Freesound RAR diffusers Hotel SQLite uwsgi Ubuntu Tensor Random Tiktoken PDF MD5 Mixtral 签证 BF16 LeetCode YOLO Tracking XML CAM Hilton Jupyter Logo Distillation Transformers Pillow Dataset UNIX OpenAI Disk Color TensorRT TTS Base64 Vim Magnet Qwen2 净利润 scipy FP64 v2ray UI Algorithm EXCEL tar GPTQ Land Python Permission TSV Breakpoint
站点统计

本站现有博文309篇,共被浏览730964

本站已经建立2367天!

热门文章
文章归档
回到顶部