Reputation: 43
When I try to convert mp4 to flv, I get this error:
Tag avc1 incompatible with output codec id '27'
Codec 27 is AV_CODEC_ID_H264
I followed the examples from the documentation, and could write an image from mp4, or remux the file using the same encoders. https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/muxing.c
AVCodec* video_codec = NULL;
// It loops through the streams and copy the parameters
for (int i=0; I<ctx->nb_streams; i++) {
if (ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
video_codec = avcodec_find_decoder(stream->codepar->codec_id);
}
}
...
const char* output_file = "output_video.flv"
// it works with mp4, not with flv
avformat_alloc_output_context2(&fmt_ctx, NULL, "flv", output_file);
...
// Error here
avformat_write_header(fmt_ctx, NULL);
Output #0, flv, to 'output_video.flv':
Stream #0:0: Video: h264 (avc1 / 0x4), none, 1920x1080, q=2-31, 6664 kb/s
Stream #0:1: Audio: aac (mp4a / 0x5), 48000 Hz, 2 channels, 128 kb/s
[flv @ 0x5] Tag avc1 incompatible with output codec id '27' ([7][0][0][0])
What does this error means and where is this tag defined? Why copying the parameters isn't enough?
Upvotes: 1
Views: 1891
Reputation: 11
Set the codec_tag (out_stream->codecpar->codec_tag) as 0 or corresponding AVI FOURCC codec tag inside the for loop for each output stream.
Upvotes: 1