[Libav-user] H264 Encoding - Could not play video using VLC Player

Yu Ang Tan isoboy at gmail.com
Thu Mar 31 02:36:23 CEST 2016


On Thu, 31 Mar 2016 at 05:43 Gonzalo <ggarra13 at gmail.com> wrote:

> Find attached a fixed version of your program.
> The main thing I think was how you were allocating the pFormatCtx.
>
> --
> Gonzalo Garramuño
> ggarra13 at gmail.com
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user



Hi Gonzalo,

You were right. av_guess_format("h264", NULL, NULL) sets
pFormatCtx->oformat into the following:

  pFormatCtx->oformat.name 0x009df614 "h264"
  pFormatCtx->oformat.long_name 0x009df619 "raw H.264 video"
  pFormatCtx->oformat.mime_type 0x00000000 <Bad Ptr>
  pFormatCtx->oformat.extensions 0x009df629 "h264,264"
  pFormatCtx->oformat.audio_codec AV_CODEC_ID_NONE
  pFormatCtx->oformat.video_codec AV_CODEC_ID_H264
  pFormatCtx->oformat.subtitle_codec AV_CODEC_ID_NONE
  pFormatCtx->oformat.flags 128
  pFormatCtx->oformat.codec_tag 0x00000000
  pFormatCtx->oformat.priv_class 0x00000000 {class_name=??? item_name=???
option=??? ...}
  pFormatCtx->oformat.next 0x009980c0 {name=0x009bb03e "hds"
long_name=0x009bb042 "HDS Muxer" mime_type=0x00000000 <Bad Ptr> ...}
  pFormatCtx->oformat.priv_data_size 0
  pFormatCtx->oformat.write_header 0x005bad70
  pFormatCtx->oformat.write_packet 0x005bac40
  pFormatCtx->oformat.write_trailer 0x00000000

whereas av_guess_format(NULL, filename, NULL) sets into the following:

  pFormatCtx->oformat.name 0x009ce84c "mp4"
  pFormatCtx->oformat.long_name 0x009ce850 "MP4 (MPEG-4 Part 14)"
  pFormatCtx->oformat.mime_type 0x009ce689 "video/mp4"
  pFormatCtx->oformat.extensions 0x009ce84c "mp4"
  pFormatCtx->oformat.audio_codec AV_CODEC_ID_AAC
  pFormatCtx->oformat.video_codec AV_CODEC_ID_H264
  pFormatCtx->oformat.subtitle_codec AV_CODEC_ID_NONE
  pFormatCtx->oformat.flags 327744
  pFormatCtx->oformat.codec_tag 0x009ce868
  pFormatCtx->oformat.priv_class 0x009ce880 {class_name=0x009ce870 "mp4
muxer" item_name=0x0062bc70 option=0x009cf300 ...}
  pFormatCtx->oformat.next 0x0099ae00 {name=0x009d104c "mpeg"
long_name=0x009d1054 "MPEG-1 Systems / MPEG program stream"
mime_type=0x009d0ec8 "video/mpeg" ...}
  pFormatCtx->oformat.priv_data_size 176
  pFormatCtx->oformat.write_header 0x0056ad20
  pFormatCtx->oformat.write_packet 0x0056a260
  pFormatCtx->oformat.write_trailer 0x0056a7f0

which is unnecessary, since avformat_alloc_output_context2( &pFormatCtx,
NULL, NULL, filename ) was doing the same thing.

Thank you very much. I wouldn't have realised this so quickly without your
help.

Regards,
Ang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160331/1d99dd79/attachment.html>


More information about the Libav-user mailing list