File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -113,21 +113,19 @@ int main(int argc, char **argv)
113
113
// Copy streams
114
114
for (size_t i = 0 , ostIdx = 0 ; i < ictx.streamsCount (); ++i) {
115
115
auto ist = ictx.stream (i);
116
- auto icoder = GenericCodecContext (ist);
116
+ auto icodecpar = ist.codecParameters ();
117
+ auto ocodec = av::findEncodingCodec (icodecpar.raw ()->codec_id );
117
118
118
119
// Source codec can be unsupprted by the target format. Transcoding required or simple skip.
119
- if (!octx.outputFormat ().codecSupported (icoder. codec () )) {
120
- clog << " Input stream " << i << " codec '" << icoder. codec () .name () <<
120
+ if (!octx.outputFormat ().codecSupported (ocodec )) {
121
+ clog << " Input stream " << i << " codec '" << ocodec .name () <<
121
122
" ' does not supported by the output format '" << oformat.name () << " '\n " ;
122
123
continue ;
123
124
}
124
125
125
- auto ocoder = GenericCodecContext ();
126
- // copy codec settings
127
- ocoder.copyContextFrom (icoder);
128
-
129
- // TBD: rework, does not work now
130
- auto ost = octx.addStream (icoder.codec (), ec);
126
+ auto ost = octx.addStream (ec);
127
+ ost.setCodecParameters (icodecpar);
128
+ ost.codecParameters ().raw ()->codec_tag = 0 ;
131
129
132
130
// We can omit codec checking above and got error FormatCodecUnsupported (error code or exception)
133
131
if (ec) {
You can’t perform that action at this time.
0 commit comments