Python library for video sharing

I need to split a large video file into smaller parts in time. Give me your suggestions, please, and if you can get some tips on using the library. Thanks.

+7
source share
2 answers

OpenCV has Python wrappers .

Since you're interested in IO video, check out the QueryFrame and its related features.

In the end, your code will look something like this (completely untested):

import cv capture = cv.CaptureFromFile(filename) while Condition1: # Need a frame to get the output video dimensions frame = cv.RetrieveFrame(capture) # Will return None if there are no frames # New video file video_out = cv.CreateVideoWriter(output_filenameX, CV_FOURCC('M','J','P','G'), capture.fps, frame.size(), 1) # Write the frames cv.WriteFrame(video_out, frame) while Condition2: frame = cv.RetrieveFrame(capture) # Will return None if there are no frames cv.WriteFrame(video_out, frame) 

By the way, there are ways to do this without writing code .

+5
source

Check youtube-upload , it splits the video using ffmpeg.

Youtube-upload is a command line script that uploads videos to Youtube. If the video does not comply with the Youtube Limitations (<2Gb and <15 '), it will be automatically divided before downloading. Youtube download should work on any platform (GNU / Linux, BSD, OS X, Windows, ...) that runs Python and FFmpeg.

+1
source

All Articles