<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:"Courier New";
mso-fareast-language:ES;}
.MsoChpDefault
{mso-style-type:export-only;
mso-fareast-language:EN-US;}
@page WordSection1
{size:8.5in 11.0in;
margin:70.85pt 85.05pt 70.85pt 85.05pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="ES" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi everyone.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I am trying to send a video file recorded on Android to a media server by using “testMPEG2TransportStreamer.cpp” later to create the TS file by using “testH264VideoToTransportStream.cpp” to an own media server. I copied
the video to my PC in order to avoid problems with live555 on Android, step by step
</span><span lang="EN-US" style="font-family:Wingdings">J</span><span lang="EN-US">.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I know that “testH264VideoToTransportStream + testMPEG2TransportStreamer “ works fine because I downloaded “slamtv60.264” from live555.com and sent out.ts, resulted from “testH264VideoToTransportStream”, by “testMPEG2TransportStreamer”
to my media server and could play the live stream in VLC (on windows) and Android *without* problems in the same time(as a media server must do).<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Then, my problem is that I am not able to transform my Android video to an *elementary h264* file. In this moment my code is the next:<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:blue">void</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas"> createH264ElementaryFile()<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas">{<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas">
<span style="color:green">// Begin by setting up our usage environment:</span><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas"> TaskScheduler* scheduler = BasicTaskScheduler::createNew();<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas"> env = BasicUsageEnvironment::createNew(*scheduler);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas">
<span style="color:green">// Open the input file as a 'byte-stream file source':</span><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas"> FramedSource* inputSource = ByteStreamFileSource::createNew(*env, inputFileName);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas">
<span style="color:blue">if</span> (inputSource == NULL) {<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas"> *env <<
<span style="color:#A31515">"Unable to open file \""</span> << inputFileName<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas"> <<
<span style="color:#A31515">"\" as a byte-stream file source\n"</span>;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas"> exit(1);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas">
<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas">
<span style="color:green">// Open the output file as a 'file sink':</span><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas"> H264VideoFileSink* outputSink = H264VideoFileSink::createNew(*env, h264FileSink);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas">
<span style="color:blue">if</span> (outputSink == NULL) {<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas"> *env <<
<span style="color:#A31515">"Unable to open file \""</span> << h264FileSink << <span style="color:#A31515">
"\" as a file sink\n"</span>;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas"> exit(1);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas">
<span style="color:green">// Finally, start playing:</span><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas"> *env <<
<span style="color:#A31515">"Beginning to read...\n"</span>;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas"> outputSink->startPlaying(*inputSource, afterPlayingcreateH264ElementaryFile, NULL);<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas"> env->taskScheduler().doEventLoop();
<span style="color:green">// does not return</span><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:70.8pt;text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I read that I need to insert before each NAL unit an start code (0x00000001), then I think I need to develop a “H264</span><span lang="EN-US" style="font-size:9.5pt;font-family:Consolas">FramedSource</span><span lang="EN-US">”
in order to insert the code, but I am not able to find an example or a tip to implement a solution.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Any suggestions?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Many thanks!!<o:p></o:p></span></p>
</div>
</body>
</html>