![]() ![]() Pkt. If ( 0 = ( pkt.flags & AV_PKT_FLAG_KEY ) ) Pkt.flags |= ( 0 >= getVopType( data, nLen ) ) ? AV_PKT_FLAG_KEY : 0 Ret = avio_open(&m_pOc->pb, pszFileName, AVIO_FLAG_WRITE) Open_video(m_pOc, video_codec, m_pVideoSt) Īv_dump_format(m_pOc, 0, pszFileName, 1) M_pVideoSt = add_stream(m_pOc, &video_codec, fmt->video_codec) If (fmt->video_codec != AV_CODEC_ID_NONE) Void open_video(AVFormatContext *oc, AVCodec *codec, AVStream *st) But it will now be in an MP4 container that should playback as expected in all compatible players. So use a command like this: ffmpeg -i input.h264 -c copy output.mp4 That will simply copy the raw contents of the input.h264 into output.mp4. If (oc->oformat->flags & AVFMT_GLOBALHEADER) Instead of converting the video, you most likely need to get that stream into an MP4 video container. If (c->codec_id = AV_CODEC_ID_MPEG1VIDEO) If (c->codec_id = AV_CODEC_ID_MPEG2VIDEO) Printf("could not find encoder for '%s' \n", avcodec_get_name(codec_id)) Ĭ->sample_fmt = (*codec)->sample_fmts ? (*codec)->sample_fmts : AV_SAMPLE_FMT_FLTP If ( b || b || 0x01 != b )ĪVStream *add_stream(AVFormatContext *oc, AVCodec **codec, enum AVCodecID codec_id) #define STREAM_PIX_FMT AV_PIX_FMT_YUV420P /* default pix_fmt */ Here's my code, using the code from Raw H264 frames in mpegts container using libavcodec and muxing.c from My H264 stream has no B-Frame, every nalu starts with 00 00 00 01,the stream begins with sps pps then the h264 data. I want to wrap the H264 Nalus(x264 encoded) into mp4 using ffmpeg(SDK 2.1), but the output mp4 file could not play.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |