[Live-devel] MPEG2 to TS Conversion Problems

Andrew Umlauf andrew_umlauf at yahoo.com
Sat Jul 25 15:32:34 PDT 2009


I am running on Windows XP compiled with VS 2005. However, I also get the error using the .mak files following the directions provided on the VS2005 hints page.

I tried compiling on several computers at my work place with no success. I additionally tried compiling with VC7, no success. I was going to try with vc6, but I could not obtain a license before quitting time. Unfortunatly I am force to run this in a windows environment.

After further investigation, I assumed that there was a problem with the way that ByteStreamFileSource was handling IO on windows. I replaced the ByteStreamFileSource with a SimpleRTPSource. I no longer get the select() error and I get a TS file that is larger then 0 bytes. However, the TS file does not display anything when played (VLC). When I comment out the TS conversion code, I get a replicated results (different in size but plays the same). 

I tried this with multiple non-audio mpeg files. Same result.

This is the code:

int main(int argc, char** argv) {
  // Begin by setting up our usage environment:
  TaskScheduler* scheduler = BasicTaskScheduler::createNew();
  env = BasicUsageEnvironment::createNew(*scheduler);

  char const* srcAddrStr = "147.159.167.150";
  struct in_addr srcAddress;
  srcAddress.s_addr = our_inet_addr(srcAddrStr);
  const Port rtpPort(8888);
  const unsigned char ttl = 7;
  Groupsock rtpGroupsock(*env, srcAddress, rtpPort, ttl);

  //FramedSource* inputSource = MPEG1or2VideoRTPSource::createNew(*env, &rtpGroupsock); //doesn't work

  FramedSource* inputSource = SimpleRTPSource::createNew(*env, &rtpGroupsock, 33, 90000, "video");
  if (inputSource == NULL) {
    *env << "Unable to open source \n";
    exit(1);
  } 

  // Create a MPEG demultiplexor that reads from that source.
  MPEG1or2Demux* baseDemultiplexor = MPEG1or2Demux::createNew(*env, inputSource);

  // Create, from this, a source that returns raw PES packets:
  MPEG1or2DemuxedElementaryStream* pesSource = baseDemultiplexor->newRawPESStream();

  // And, from this, a filter that converts to MPEG-2 Transport Stream frames:
  FramedSource* tsFrames
    = MPEG2TransportStreamFromPESSource::createNew(*env, pesSource);


  // FramedSource* tsFramed = inputSource; //Short Circuit

  // Open the output file as a 'file sink':
  MediaSink* outputSink = FileSink::createNew(*env, outputFileName);
  if (outputSink == NULL) {
    *env << "Unable to open file \"" << outputFileName << "\" as a file sink\n";
    exit(1);
  }

  // Finally, start playing:
  *env << "Beginning to read...\n";
  outputSink->startPlaying(*tsFrames, afterPlaying, NULL);

  env->taskScheduler().doEventLoop(); // does not return

  return 0; // only to prevent compiler warning
}


Being new to Live555 my invalid out.ts is probably just a result of improperly utitilizing the SimpleRTPSink. However as I look through the forums and do google searches, it seems lots of people are having problems with the select() error. This error limits me from running alot of the test executables. Fortunatly, I think I will be able to get around using a ByteStreamFileSource in the solution that i need it for.

Let me know what you think. I appreciate the help.

-Andrew U.

--- On Fri, 7/24/09, Ross Finlayson <finlayson at live555.com> wrote:

> From: Ross Finlayson <finlayson at live555.com>
> Subject: Re: [Live-devel] MPEG2 to TS Conversion Problems
> To: "LIVE555 Streaming Media - development & use" <live-devel at ns.live555.com>
> Date: Friday, July 24, 2009, 4:38 PM
> >I am having issues with the
> testMPEG1or2ProgramToTransportStream file.
> >
> >Here is what I have done.
> >
> >1. At first, when I ran the program I would get the
> following error:
> >
> >     Beginning to read...
>>    BasicTaskScheduler::SingleStep(): select()
> fails: No error
> 
> This is your problem; any attempt to 'work around' it will
> be futile.
> 
> That message usually means a problem with your networking
> interface, 
> or network interface library.
> 
> What OS are you running this on?
> _______________________________________________
> live-devel mailing list
> live-devel at lists.live555.com
> http://lists.live555.com/mailman/listinfo/live-devel
> 


      


More information about the live-devel mailing list