[FFmpeg-trac] #3107(undetermined:new): Problem using muxing example

FFmpeg trac at avcodec.org
Tue Nov 12 01:54:10 CET 2013

#3107: Problem using muxing example
             Reporter:  ahsan        |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
              Version:  unspecified  |  undetermined
             Keywords:               |               Resolution:
             Blocking:               |               Blocked By:
Analyzed by developer:  0            |  Reproduced by developer:  0

Comment (by ahsan):

 I merged, demux and mux example codes so that i can take in any
 .mp4/.avi/mpg files and then re-encode them in the same format

 I am having following issues

 1. MUX example code uses avformat_alloc_output_context2() to create the
 output context for example for .mpg it will choose MPEG1 encoder, the .mpg
 file i used is encoded using MPEG2 encoder.

 I was wondering how can i select different encoders, is there any API call
 which i can use to re-set the encoder name in the context encoder fails

 2. I uses the fmt_ctx from decoder to set the encoder parameters, i try to
 memcpy the context (decoder to encoder for the codec) but it fails by
 setting the different parameters from fmt_ctx to the c

 c->width = fmt_ctx->streams[video_stream_idx]->codec->width;
 c->height = fmt_ctx->streams[video_stream_idx]->codec->height;
 c->coded_width = fmt_ctx->streams[video_stream_idx]->codec>coded_width;
 c->gop_size = fmt_ctx->streams[video_stream_idx]->codec->gop_size;
               /* emit one intra frame every twelve frames at most */

 c->bit_rate = (fmt_ctx->streams[video_stream_idx]->codec->bit_rate == 0) ?
 400000 :
  /* i am seting it to 400kbps in case it is set to 0 as i am seeing it for
 some stream */


 I am seeing different issue

 1. GOP Size fmt_ctx most of the time has gop_size = 12 which does not
 seems like the case for the original/input stream

 2. bit-rate i am getting in the output .mp4 is way higher then the one i
 see from the fmt_ctx, it seems like encoded bit-stream is in 50Mbits/sec
 where as input .mp4 was 300kbps or 400kbps bit-rate

 I am wondering what is the best way to set the encoder context using the
 input bitstream
 [.mp4, .avi, .mpg etc] files

 Please let me know if you are able to figure it out

Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/3107#comment:10>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list