[Libav-user] Create a muxer without enc_ctx = out_stream->codec
Charles
linux2 at orion15.org
Tue Aug 23 02:32:24 EEST 2016
I seem to be lost in where the values get copied.
Want to create a new h.264 file without an input stream to copy from
Steps
1 - av_encode_codec = avcodec_find_encoder( codec_id )
2 - av_encode_codec_ctx = avcodec_alloc_context3( av_encode_codec )
av_encode_codec_ctx->width = w_; /// \note multiple of 2
av_encode_codec_ctx->height = h_; /// \note multiple of 2
3 - avcodec_open2( av_encode_codec_ctx, av_encode_codec, &av_dict_opts )
4 - avformat_alloc_output_context2( &av_out_fmt_ctx, NULL, (char*)"mp4", fname )
5 - video_st = avformat_new_stream( av_out_fmt_ctx, av_encode_codec )
av_out_fmt_ctx->streams[ 0 ]->codecpar->width = w_;
av_out_fmt_ctx->streams[ 0 ]->codecpar->height = h_;
6 - avcodec_parameters_to_context( av_encode_codec_ctx, av_out_fmt_ctx->streams[ 0 ]->codecpar )
7 - avio_open( &av_out_fmt_ctx->pb, fname, AVIO_FLAG_WRITE )
8 - avformat_write_header( av_out_fmt_ctx, NULL )
[mp4 @ 0x29b4060] dimensions not set
transcoding.c
is using enc_ctx = out_stream->codec;
Which should be the same as av_encode_codec_ctx
What am I missing here?
Thanks
cco
More information about the Libav-user
mailing list