[Live-devel] about multiplexing audio and h264 video into ts file

HilmanKevin kevinhilman at hotmail.com
Sun Nov 6 06:32:08 PST 2011


hi,everyone
 
i want to revise live/testprogs/testH264VideoToTransportStream.cpp to add the function of multiplexing audio and  h264 video into ts file.i add some code here like red code below.Am i right to complete my goal?any light would be appreciated.thanks a lot.
 
int main(int argc, char** argv) {
  // Begin by setting up our usage environment:
  TaskScheduler* scheduler = BasicTaskScheduler::createNew();
  env = BasicUsageEnvironment::createNew(*scheduler);
  // Open the input file as a 'byte-stream file source':
  FramedSource* inputSource = ByteStreamFileSource::createNew(*env, inputFileName);
  if (inputSource == NULL) {
    *env << "Unable to open file \"" << inputFileName
  << "\" as a byte-stream file source\n";
    exit(1);
  }
   H264VideoStreamFramer* framer = H264VideoStreamFramer::createNew(*env, inputSource, True/*includeStartCodeInOutput*/);
    MPEG2TransportStreamFromESSource* tsFrames = MPEG2TransportStreamFromESSource::createNew(*env);
  tsFrames->addNewVideoSource(framer, 5/*mpegVersion: H.264*/);
 tsFrames->addNewaudioSource(audiofileinputsource,?)  ;
  // 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
}

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20111106/a96311d7/attachment.html>


More information about the live-devel mailing list