I have been working with trying to write video based on stuff from input video
in different formats. However, when I write frames to the file it always ends
up in poorer quality than the original. I have tried changing different settings
individually but it does very little difference. Here are the settings that I
use when I form a video stream for the output file. (Yes, I used code from
output_example.c in FFmpeg as reference) Is there a setting that I am missing or
something I should try to better the quality of video regardless of the format?
If it is format specific I more commonly use .avi, .mov, .mp4, and .wmv. Most
cases I end up using the info from the input file to feed to the output file.

================================================================================

videoStream->codec->codec_id = formatContext->oformat->video_codec;
videoStream->codec->codec_type = CODEC_TYPE_VIDEO;
videoStream->codec->bit_rate = bitRate;
videoStream->codec->width = width;
videoStream->codec->height = height;
videoStream->codec->time_base.den = fpsNum;
videoStream->codec->time_base.num = fpsDen;
videoStream->codec->gop_size = OVSTREAM_GOP;
videoStream->codec->pix_fmt = PIX_FMT_YUV420P;
if (videoStream->codec->codec_id == CODEC_ID_MPEG2VIDEO)
  videoStream->codec->max_b_frames = 2;
if (videoStream->codec->codec_id == CODEC_ID_MPEG1VIDEO)
  videoStream->codec->mb_decision = 2;
if (!strcmp(formatContext->oformat->name, "mp4")
  || !strcmp(formatContext->oformat->name, "mov")
  || !strcmp(formatContext->oformat->name, "3gp"))
  videoStream->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;

_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to