diff --git a/DASHEncoder.config b/DASHEncoder.config index c192928..a617428 100644 --- a/DASHEncoder.config +++ b/DASHEncoder.config @@ -6,8 +6,8 @@ # General Options #======================================== -dest-directory : /opt/lampp/htdocs/tests_updates/ - +#dest-directory : /opt/lampp/htdocs/tests_updates/ +dest-directory : /home/arawind/d/dash/ video-encoder : x264 audio-encoder : ffmpegAAC @@ -19,27 +19,30 @@ sql-user : root sql-pw : sql-database : dash -add-non-segmented +#add-non-segmented -#use-ffmpeg-pipe -ffmpeg-opt : -f rawvideo +use-ffmpeg-pipe +ffmpeg-opt : -f rawvideo -t 30 #input-res : 384x208 #input-res : 352x288 -input-res : 854x480 +#input-res : 854x480 +input-res : 720x400 #======================================== # x264 Options #======================================== -bitrate : 300 +#bitrate : 2071 -#bitrate : 250@480x360|500@480x360|1000 +#bitrate : 50@480x360|100@480x360|200 +bitrate : 50@320x240|100@320x240 #bitrate : 200|400|600|1000 statistics : stat.temp gop : 48 scenecut : 0 profile : baseline preset : slow -input : /home/stefan/sintel_trailer_2k_480p24.y4m +input : /home/arawind/d/dash/bunny.mp4 +#input : /home/stefan/sintel_trailer_2k_480p24.y4m #input : /home/stefan/foreman_cif.y4m #input : /home/stefan/kingkong.mp4 #input : /media/Volume/MI200802010028-video_newsroom_hd_1080_p29_97-channelSelectionT0C0_T0C1.mp4 @@ -61,8 +64,10 @@ pass2 : --verbose --psnr #audio-quality : 2,44100,48 audio-quality : -audio-input : /home/stefan/sintel_trailer-audio.flac -audio-codec : libfaac +#audio-input : /home/stefan/sintel_trailer-audio.flac +audio-input : /home/arawind/d/dash/bunny.mp4 +#audio-codec : libfaac +audio-codec : aac #======================================== # MP4Box Options @@ -75,18 +80,21 @@ mux-combi : fragment-size : 2000 segment-size : 2000 rap-aligned -segment-name : sintel -folder-prefix : sintel +segment-name : bunny +#segment-name : sintel +#folder-prefix : sintel +folder-prefix : bunny #======================================== # MPD Options #======================================== -mpd-name : sintel.mpd -url-root : http://localhost/tests_updates/ +mpd-name : bunny.mpd +url-root : http://172.16.46.127/dash/dash/ #set-base-url mpdActStandardPostfix : _actVersion.mpd -duration : 9M4S +duration : 9M56S +#duration : 9M4S transform-mpd minBufferTime : 2.0S segDuration : 2 diff --git a/DASHEncoder.cpp b/DASHEncoder.cpp index 9f24886..afe5ca7 100644 --- a/DASHEncoder.cpp +++ b/DASHEncoder.cpp @@ -53,10 +53,11 @@ void parse(int argc, char* argv[]) std::cout << "current encoder " << opt->getValue("video-encoder") << "\n"; if(getEncoder(opt->getValue("video-encoder")) == IEncoder::x264) std::cout << "YES\n"; - AbstractVideoEncoder* e = (AbstractVideoEncoder*)encoder_factory->getEncoder(opt, getEncoder(opt->getValue("video-encoder"))); AbstractAudioEncoder* a = (AbstractAudioEncoder*)encoder_factory->getEncoder(opt, getEncoder(opt->getValue("audio-encoder"))); + + MPDGenerator* mpdgen = new MPDGenerator(); MPDGenerator* mpdgenNonSeg = new MPDGenerator(); MP4BoxMultiplexer* m = new MP4BoxMultiplexer(); @@ -64,6 +65,7 @@ void parse(int argc, char* argv[]) std::map audio_files; std::map av_mux_mapping; + /* MySQL Support Disabled MYSQL_RES *result; @@ -149,6 +151,7 @@ void parse(int argc, char* argv[]) } /************************ AUDIO PROCESSING ******************************/ + std::string audio_quality = opt->getValue("audio-quality"); char*c2 = (char*) malloc(audio_quality.length() * sizeof(char)); strcpy(c2, audio_quality.c_str()); @@ -158,9 +161,10 @@ void parse(int argc, char* argv[]) std::string act_audio_encoding; std::string act_audio_seg; + std::cout << "\nAAAAA" << h264file << "AAAAAAAA" << std::endl; + while (act_audio != NULL) { - act_quality = act_audio; a->setChannels(atoi(act_quality.substr(0, act_quality.find(',')).c_str())); @@ -313,7 +317,7 @@ void parse(int argc, char* argv[]) folder.append(foldername); folder.append("/"); folder.append(audio_files[av_mux_mapping[e->getBitrate()]]); - std::cout << "copy audio: " << folder; + std::cout << "copy audio: " << folder << std::endl; system(folder.c_str()); } @@ -404,6 +408,7 @@ void parse(int argc, char* argv[]) af.append(audio_files[av_mux_mapping[e->getBitrate()]]); m->setAudioFile(af); + } std::string mpd = m->multiplex(h264new); @@ -438,15 +443,32 @@ void parse(int argc, char* argv[]) act_rep = act_rep.substr(act_rep.find("") - act_rep.find("getFlag("add-non-segmented")){ /************ GENERATE UNSEGMENTED FILE *****/ std::string tmp_rep = act_rep; tmp_rep = m->unSegment(tmp_rep); + std::cout << "error in here\n"; + while (tmp_rep.find(m->getOutputDir()) != std::string::npos) { + if(opt->getFlag("set-base-url")) tmp_rep.replace(tmp_rep.find(m->getOutputDir()), m->getOutputDir().size(), ""); else @@ -696,7 +718,6 @@ int convertMPD(std::string input, std::string output, std::string duration, std: finalMPDhead.append(" \n"); mpdexportfile << finalMPDhead; - finalMPDfoot.append(" \n"); finalMPDfoot.append(" \n"); finalMPDfoot.append("\n"); @@ -709,7 +730,9 @@ int convertMPD(std::string input, std::string output, std::string duration, std: while(mpd_temp.find("", lastRep)+ 17 - mpd_temp.find("", lastRep)+ 17 - mpd_temp.find("", lastRep)+ 17; finalRep = ""; @@ -718,13 +741,22 @@ int convertMPD(std::string input, std::string output, std::string duration, std: addID.append(DASHHelper::itos(id)); addID.append("\""); - temp2 = "")); temp.append(">\n"); @@ -732,29 +764,39 @@ int convertMPD(std::string input, std::string output, std::string duration, std: //add init segment - pos = act_rep.find("", pos)+2 - pos); - temp2 = "InitialisationSegmentURL"; - temp.replace(temp.find(temp2), temp2.length(), "Initialisation"); + /*temp2 = "InitialisationSegmentURL"; + temp.replace(temp.find(temp2), temp2.length(), "Initialisation");*/ pos = act_rep.find("/>", pos)+2; finalRep.append("\n "); finalRep.append(temp); finalRep.append("\n\n"); - +//TILL HERE //add segments finalRep.append(""); - temp = act_rep.substr(pos, act_rep.find("",pos) -pos); - temp2 = "",pos) -pos); + //temp = act_rep.substr(pos, act_rep.find("",pos) -pos); + temp2 = "\n"); diff --git a/multiplexer/MP4BoxMultiplexer.cpp b/multiplexer/MP4BoxMultiplexer.cpp index 0b6074f..c45c9b8 100644 --- a/multiplexer/MP4BoxMultiplexer.cpp +++ b/multiplexer/MP4BoxMultiplexer.cpp @@ -80,7 +80,6 @@ std::string MP4BoxMultiplexer::multiplex (){ std::cout << "mp4box: " <input << " \n"; mp4box = "MP4Box "; @@ -103,12 +102,27 @@ std::string MP4BoxMultiplexer::multiplex (){ mp4box.append(this->input.substr(0,this->input.find_last_of("."))); mp4box.append(".mp4"); + mp4box.append(" "); + + //mp4box.append("-out "); + //std::string mpd = this->input.substr(this->input.find_last_of("/")+1); + //mp4box.append(mpd.substr(0, mpd.find_last_of(".")));//, this->input.find_last_of("."))); + //mp4box.append(this->input.substr(0,this->input.find_last_of("."))); + //mp4box.append("_dash.mpd"); std::cout << "mp4box: " <input.substr(this->input.find_last_of("/")+1); + moveMPD = moveMPD.substr(0,moveMPD.find_last_of(".")); + moveMPD.append("_dash.mpd"); std::string mpd = this->input.substr(0,this->input.find_last_of(".")); mpd.append("_dash.mpd"); + moveMPD.append(" "); + moveMPD.append(mpd); + std::cout << "\nMove mpd from current directory: " << moveMPD << "\n" ; + system(moveMPD.c_str()); + return mpd; }