Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4045732
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:28:16+00:00 2026-05-20T13:28:16+00:00

I have a program that can generate video in real time. Now I would

  • 0

I have a program that can generate video in real time. Now I would like to stream this video online while it is being generated. Does anybody know an easy way to do it?

I am describing a CGI approach I tried but did not work, but please note that I am open to all options that would achieve my goal. I am just wondering if anybody knows why my approach doesn’t work and how I should fix it

I set the content-type to mpeg for example, and print out a chunk of data in the mpeg file periodically. But the video only lasts for very short amount of time and stop streaming. My code is something like this (in Python).

print "Content-type: video/mpeg"
print
f = open("test2.mpg")
while (True):
    st = f.read(1024*1024)
    sys.stdout.write(st)
    time.sleep(0.5)

Though this would work fine. I really don’t see why the output of these two programs are different. But obviously I can’t use this approach since i can’t wait until the entire file is generated before reading in.

print "Content-type: video/mpeg"
print
f = open("test2.mpg")
print f.read()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T13:28:17+00:00Added an answer on May 20, 2026 at 1:28 pm

    What type of file is test2.mpg?

    If it’s an mpeg4 file your approach won’t work because you will have headers at the start or end of the file.
    If your file is an mpeg2 transport stream, then this should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Java program that auto dials phone numbers, it can generate sounds
I would like to write a program or script that would generate .vcproj and
I have a program that generates text fiels that can be up to 20
I have a program that can have a lot of parameters (we have over
I have a C#/.NET program that can run both as a console application and
We have a Java program run as root on Unix, that therefore can read
I have a program that uses XSL-FO (org.apache.fop.apps.Driver) to generate a PDF print out
I have this program that I want other processes to be able to call
I have a C# program that uses a production grammar to generate 3D models
I have a program that is using the excel interop routines to generate a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.