summaryrefslogtreecommitdiff
path: root/rotord/src
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2013-11-14 11:49:57 +0000
committerTim Redfern <tim@eclectronics.org>2013-11-14 11:49:57 +0000
commit17993784daaa38098b9430824333a2ff72757930 (patch)
treeb313cd0ce09cc7a6000dd21e96985c93252e543b /rotord/src
parentc95f125f3296d75789685fe1ababe48abe161973 (diff)
lower default data rate
Diffstat (limited to 'rotord/src')
-rw-r--r--rotord/src/graph.h7
-rw-r--r--rotord/src/libavwrapper.cpp36
2 files changed, 28 insertions, 15 deletions
diff --git a/rotord/src/graph.h b/rotord/src/graph.h
index ad2c59d..129d754 100644
--- a/rotord/src/graph.h
+++ b/rotord/src/graph.h
@@ -25,11 +25,10 @@ copy nodes `
namespace Rotor {
class Graph{
public:
- Graph(){duration=20.0f;loaded = false;outW=640;outH=360;audio_thumb=new Audio_thumbnailer();use_fragmentation=false;analysis_seed=0;};
+ Graph(){duration=20.0f;loaded = false;audio_loaded=false;bitRate=28000;outW=640;outH=360;audio_thumb=new Audio_thumbnailer();use_fragmentation=false;analysis_seed=0;};
Graph(const string& _uid,const string& _desc){
+ Graph();
init(_uid,_desc);
- audio_loaded=false;
- bitRate=1000000;
};
void init(const string& _uid,const string& _desc){
uid=_uid;
@@ -65,7 +64,7 @@ namespace Rotor {
bool load_audio(const string &filename,vector<Audio_processor*> processors);
bool load_video(const string &nodeID,const string &filename);//can be performance or clip
bool set_bitrate(int b){
- if (b>64000){
+ if (b>1000){
bitRate=b;
return true;
}
diff --git a/rotord/src/libavwrapper.cpp b/rotord/src/libavwrapper.cpp
index c4d267a..c3fa235 100644
--- a/rotord/src/libavwrapper.cpp
+++ b/rotord/src/libavwrapper.cpp
@@ -174,6 +174,8 @@ bool libav::exporter::record(std::string filename){
}
fmt = oc->oformat;
+ av_opt_set(oc->priv_data, "profile", "baseline", AV_OPT_SEARCH_CHILDREN);
+
// Add the audio and video streams using the default format codecs
// * and initialize the codecs. //
@@ -181,7 +183,7 @@ bool libav::exporter::record(std::string filename){
audio_st = NULL;
fmt->video_codec=AV_CODEC_ID_H264; //AV_CODEC_ID_MPEG4
- //fmt->audio_codec=AV_CODEC_MP3; //guessing, 011013
+ fmt->audio_codec=AV_CODEC_ID_AAC; //guessing, 011013
if (fmt->video_codec != AV_CODEC_ID_NONE) {
@@ -205,11 +207,22 @@ bool libav::exporter::record(std::string filename){
video_st->codec->gop_size = 75; /* emit one intra frame every 75 frames */
video_st->codec->pix_fmt = PIX_FMT_YUV420P;
+ cerr<<"Libav::exporter setting bitrate to "<<bitRate<<endl;
+
+
+ video_st->codec->bit_rate = bitRate; //need to deal with resolution etc
+ video_st->codec->rc_max_rate = bitRate;
+ video_st->codec->rc_min_rate = 0;
- //video_st->codec->bit_rate = bitRate; //need to deal with resolution etc
- //video_st->codec->rc_max_rate = bitRate;
- //video_st->codec->rc_min_rate = 0;
+ //added 131113
+ video_st->codec->rc_buffer_size = bitRate * 2;
+ //av_dict_set(&options, "profile", "baseline", 0);
+ //video_st->codec->flags2 = CODEC_FLAG2_FASTPSKIP;
+ video_st->codec->profile = FF_PROFILE_H264_BASELINE;
+ video_st->codec->level = 13;
+
+
//how to set profile????? 190913
//this causes a crash
//av_opt_set(video_st->codec->priv_data,"profile",FF_PROFILE_H264_CONSTRAINED_BASELINE, 0);
@@ -218,6 +231,8 @@ bool libav::exporter::record(std::string filename){
// http://libav-users.943685.n4.nabble.com/Libav-user-H264-encoding-set-target-average-bitrate-td3912529.html
// http://trac.ffmpeg.org/wiki/x264EncodingGuide
+
+
// Now that all the parameters are set, we can open the audio and
// * video codecs and allocate the necessary encode buffers. //
@@ -363,6 +378,7 @@ void libav::exporter::finishRecord(){
AVStream* libav::exporter::add_stream(AVFormatContext *oc, AVCodec **codec,enum AVCodecID codec_id)
{
+ //removed some of the repeats from record() 141113
AVCodecContext *c;
AVStream *st;
@@ -394,13 +410,11 @@ AVStream* libav::exporter::add_stream(AVFormatContext *oc, AVCodec **codec,enum
case AVMEDIA_TYPE_VIDEO:
c->codec_id = codec_id;
+
+ //c->bit_rate = bitRate; //need to deal with resolution etc
-
-
- c->bit_rate = bitRate; //need to deal with resolution etc
-
- c->rc_max_rate = bitRate;
- c->rc_min_rate = 0;
+ // c->rc_max_rate = bitRate;
+ //c->rc_min_rate = 0;
//c->rc_buffer_size = Profile()->m_videoMaxVopSize; //??
/*
@@ -419,7 +433,7 @@ AVStream* libav::exporter::add_stream(AVFormatContext *oc, AVCodec **codec,enum
// * identical to 1. //
c->time_base.den = frameRate;
c->time_base.num = 1;
- c->gop_size = 12; // emit one intra frame every twelve frames at most //
+ // c->gop_size = 12; // emit one intra frame every twelve frames at most //
c->pix_fmt = AV_PIX_FMT_YUV420P; //ADDED HARDCODED TJR 280513
if (c->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
// just for testing, we also add B frames //