import os

segmentbytes = 5242880
fullbytes = os.path.getsize("Wildlife.wmv")
numframe = fullbytes / segmentbytes
remainder = fullbytes % segmentbytes

parts = [open("Wildlife_Part%i.wmv" %i ,'wb') for i in range(numframe)]
with open("Wildlife.wmv",'rb') as f:

    segment = f.read(segmentbytes)


for j in range(numframe):
    parts[j].write(segment)
    f = open("Segment.txt", "wb")
    for i in range(numframe):
        f.write("Wildlife_Part%i.wmv" %i  + "\r\n")

for f in parts:

`    f.close()`

I am working on a project that enables file segmentation. The problem is that when the video get segment into parts, each and every parts shows the same output, when the output is suppose to be each part would show only 1 part of the video.

Recommended Answers

All 2 Replies

  • The line:
    segment = f.read(segmentbytes)

should be in the "for j in range(numframe)" loop.

  • Your numframe is not correct. Shoult be +1.

It managed to segment the first part of the video out but after that for the next four parts it failed to segment and nothing appeared.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.