From 252224c0263c3b1d125ea221a78547fe051ee0e2 Mon Sep 17 00:00:00 2001 From: Comment Date: Tue, 1 Oct 2013 03:35:50 +0100 Subject: very painful debugging --- ffmpeg/version.h | 2 +- rotord/src/graph.cpp | 24 +----------------------- rotord/src/libavwrapper.cpp | 11 +++++++++++ 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/ffmpeg/version.h b/ffmpeg/version.h index cef6052..17e4c89 100644 --- a/ffmpeg/version.h +++ b/ffmpeg/version.h @@ -1 +1 @@ -#define FFMPEG_VERSION "git-2013-09-05-741fb4b" +#define FFMPEG_VERSION "git-2013-10-01-ff7a134" diff --git a/rotord/src/graph.cpp b/rotord/src/graph.cpp index 059f21b..771a807 100644 --- a/rotord/src/graph.cpp +++ b/rotord/src/graph.cpp @@ -81,9 +81,6 @@ bool Graph::preview(xmlIO &XML,string &node,string &_format,int frame,int w,int bool Graph::video_render(const string &output_filename,const float framerate,int start, int stop) { if (output_filename.size()==0) return false; - - Logger& logger = Logger::get("Rotor"); - //https://www.adobe.com/devnet/video/articles/mp4_movie_atom.html //https://www.google.ie/search?q=ffmbc&aq=f&oq=ffmbc&aqs=chrome.0.57j0l2j60j0j60.4360j0&sourceid=chrome&ie=UTF-8#q=ffmbc+git @@ -100,16 +97,12 @@ bool Graph::video_render(const string &output_filename,const float framerate,int if (audio_filename!=""){ //BETTER WAY TO KNOW IF WE ARE USING AUDIO? video_output->create_envelope(audio_thumb->audiodata); } - logger.information("Video_output 1"); - for (auto f: find_nodes("video_feedback")){ (dynamic_cast(f))->set_feedback(&(video_output->image)); } // //setup defaults - - logger.information("Video_output 2"); AVCodecID codecId=AV_CODEC_ID_H264; //MPEG4; std::string container; @@ -119,33 +112,20 @@ bool Graph::video_render(const string &output_filename,const float framerate,int } else container=".mp4"; - logger.information("Video_output 3"); - //at the moment it crashes if you render before audio is loaded and also on 2nd render libav::exporter exporter; - logger.information("Video_output 4"); - float spct=100.0f/duration; - logger.information("Video_output 5"); - if (exporter.setup(outW,outH,bitRate,framerate,container,use_fragmentation)) { //codecId, - logger.information("Video_output 6"); if (exporter.record(output_filename)) { - logger.information("Video_output 7"); - libav::audio_decoder audioloader; - logger.information("Video_output 8"); - bool usingaudio=audioloader.open(audio_filename); float *avframe=nullptr; - logger.information("Video_output 9"); - - + Logger& logger = Logger::get("Rotor"); logger.information("Video_output rendering "+output_filename+": "+toString(duration)+" seconds at "+toString(framerate)+" fps, audio frame size: "+toString(exporter.get_audio_framesize())); //25fps video and 43.06640625fps audio? hmm //how to get the timecodes correct for the interleaved files @@ -166,8 +146,6 @@ bool Graph::video_render(const string &output_filename,const float framerate,int audio=new uint16_t[samples_in_frame*audioloader.get_number_channels()]; } - logger.information("Video_output 10"); - float vstep=1.0f/framerate; float v=0.0f; float vf=start*vstep; diff --git a/rotord/src/libavwrapper.cpp b/rotord/src/libavwrapper.cpp index e439075..dee8d47 100644 --- a/rotord/src/libavwrapper.cpp +++ b/rotord/src/libavwrapper.cpp @@ -136,8 +136,13 @@ bool libav::exporter::setup(int w,int h, int bitRate, int frameRate, std::string bool libav::exporter::record(std::string filename){ + printf("exporter 1 - using filename '%s'.\n",filename.c_str()); + // allocate the output media context // avformat_alloc_output_context2(&oc, NULL, NULL, filename.c_str()); + + rintf("exporter 2.\n"); + if (!oc) { printf("Could not deduce output format from file extension: using MPEG.\n"); avformat_alloc_output_context2(&oc, NULL, "mpeg", filename.c_str()); @@ -147,6 +152,8 @@ bool libav::exporter::record(std::string filename){ } fmt = oc->oformat; + rintf("exporter 3.\n"); + // Add the audio and video streams using the default format codecs // * and initialize the codecs. // video_st = NULL; @@ -162,6 +169,8 @@ bool libav::exporter::record(std::string filename){ audio_st = add_stream(oc, &audio_codec, fmt->audio_codec); } + rintf("exporter 4.\n"); + //set initial video params video_st->codec->width=w; video_st->codec->height=h; @@ -196,6 +205,8 @@ bool libav::exporter::record(std::string filename){ std::cerr << "opened audio codec with "<