File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,9 @@ AvOutputStream& OutputFile::addVideoStream( const VideoDesc& videoDesc )
85
85
INT_MAX );
86
86
87
87
_stream->time_base = _stream->codec ->time_base ;
88
+
89
+ _outputStreams.push_back ( AvOutputStream ( *this , _formatContext->nb_streams ) );
90
+
88
91
return _outputStreams.back ();
89
92
}
90
93
@@ -101,6 +104,8 @@ AvOutputStream& OutputFile::addAudioStream( const AudioDesc& audioDesc )
101
104
_stream->codec ->channels = audioDesc.getCodecContext ()->channels ;
102
105
_stream->codec ->sample_fmt = audioDesc.getCodecContext ()->sample_fmt ;
103
106
107
+ _outputStreams.push_back ( AvOutputStream ( *this , _formatContext->nb_streams ) );
108
+
104
109
return _outputStreams.back ();
105
110
}
106
111
@@ -111,9 +116,14 @@ AvOutputStream& OutputFile::getStream( const size_t streamId )
111
116
112
117
bool OutputFile::beginWrap ( )
113
118
{
114
- if ( avformat_write_header ( _formatContext, NULL ) != 0 )
119
+ int ret = avformat_write_header ( _formatContext, NULL );
120
+ if ( ret != 0 )
115
121
{
116
- throw std::runtime_error ( " could not write header" );
122
+ char err[250 ];
123
+ av_strerror ( ret, err, 250 );
124
+ std::string msg = " could not write header: " ;
125
+ msg += err;
126
+ throw std::runtime_error ( msg );
117
127
}
118
128
return true ;
119
129
}
You can’t perform that action at this time.
0 commit comments