[FFmpeg-devel] [PATCH]Refuse to mux H.264 without startcode in avi

Michael Niedermayer michaelni at gmx.at
Fri May 23 01:56:07 CEST 2014


On Fri, May 23, 2014 at 12:57:47AM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Current vanilla WMP does support H264 video in avi if it has startcodes and if 
> the codec_tag is H264.
> Particularly the first dependency is not well documented afaict, see also 
> ticket #3638. Attached patch refuses to mux H264 without startcode into avi, 
> an alternative would be to just print a warning: Players != WMP seem to work 
> fine.
> 
> Please comment, Carl Eugen

>  Makefile |    2 +-
>  avienc.c |    6 ++++++
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 9f6598fbbf6643567eecb6540ad3fc87fe109ad7  patchh264avi.diff
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index b9ef19e..c2411ca 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -83,7 +83,7 @@ OBJS-$(CONFIG_AST_MUXER)                 += ast.o astenc.o
>  OBJS-$(CONFIG_AU_DEMUXER)                += au.o pcm.o
>  OBJS-$(CONFIG_AU_MUXER)                  += au.o rawenc.o
>  OBJS-$(CONFIG_AVI_DEMUXER)               += avidec.o
> -OBJS-$(CONFIG_AVI_MUXER)                 += avienc.o avlanguage.o
> +OBJS-$(CONFIG_AVI_MUXER)                 += avienc.o mpegtsenc.o avlanguage.o
>  OBJS-$(CONFIG_AVISYNTH)                  += avisynth.o
>  OBJS-$(CONFIG_AVM2_MUXER)                += swfenc.o swf.o
>  OBJS-$(CONFIG_AVR_DEMUXER)               += avr.o pcm.o
> diff --git a/libavformat/avienc.c b/libavformat/avienc.c
> index 4544a68..22be22a 100644
> --- a/libavformat/avienc.c
> +++ b/libavformat/avienc.c
> @@ -26,6 +26,7 @@
>  #include "avi.h"
>  #include "avio_internal.h"
>  #include "riff.h"
> +#include "mpegts.h"
>  #include "libavformat/avlanguage.h"
>  #include "libavutil/avstring.h"
>  #include "libavutil/intreadwrite.h"
> @@ -570,6 +571,11 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
>      AVIStream *avist    = s->streams[stream_index]->priv_data;
>      AVCodecContext *enc = s->streams[stream_index]->codec;
>  
> +    if (enc->codec_id == AV_CODEC_ID_H264) {

this check should be on the fourcc not the codec id, at least if one
is pedantic
different fourccs can and likely do have different official
decoder implementations, which may have different limitations
and some might even reject what others require

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140523/a3391f6f/attachment.asc>


More information about the ffmpeg-devel mailing list