[Live-devel] Creating Transport Stream file from MPEG-2 Elementary video file
Drew, Steve
Steve.Drew at gdcanada.com
Fri Jun 22 06:58:39 PDT 2007
Hello,
I am having problems trying to create a Transport Stream file from
MPEG-2 Elementary Video files. I have successfully converted from
program stream using testMPEG1or2ProgramToTransportStream, and have
successfully streamed using testMPEG1or2VideoStreamer, but I would like
to send using transport stream instead.
I have made some slight modifications to
testMPEG1or2ProgramToTransportStream as noted below. This program
results in a choppy and condensed transport stream file where the video
seems to lack any sense of timing. I was hoping someone could verify
the following program. I am using Windows XP with MinGW compiler.
#include "liveMedia.hh"
#include "BasicUsageEnvironment.hh"
char const* inputFileName = "in.mpg";
char const* outputFileName = "out.ts";
void afterPlaying(void* clientData); // forward
UsageEnvironment* env;
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);
}
MPEG2TransportStreamFromESSource* tsFrames
= MPEG2TransportStreamFromESSource::createNew(*env);
// Add the elementary video file stream source
tsFrames->addNewVideoSource(inputSource, 2);
// 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
}
void afterPlaying(void* /*clientData*/) {
*env << "Done reading.\n";
*env << "Wrote output file: \"" << outputFileName << "\"\n";
exit(0);
}
___________________
Thanks,
Steve
The information contained in this e-mail message is PRIVATE. It may contain confidential information and may be legally privileged. It is intended for the exclusive use of the addressee(s). If you are not the intended recipient, you are hereby notified that any dissemination, distribution or reproduction of this communication is strictly prohibited. If the intended recipient(s) cannot be reached or if a transmission problem has occurred, please notify the sender immediately by return e-mail and destroy all copies of this message.
Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.live555.com/pipermail/live-devel/attachments/20070622/aa97eeaa/attachment-0001.html
More information about the live-devel
mailing list