[FFmpeg-devel] [PATCH]Refuse to mux invalid transport streams
Michael Niedermayer
michaelni at gmx.at
Sun Jun 8 03:23:47 CEST 2014
On Sun, Jun 01, 2014 at 02:58:41PM +0200, Carl Eugen Hoyos wrote:
> Hi!
>
> On Sunday 19 May 2013 10:21:59 pm Carl Eugen Hoyos wrote:
> > FFmpeg currently allows to mux transport streams that cannot be
> > decoded, attached patch allows to report an error in such a case.
>
> I still believe this is an important issue (that hits
> users regularly). I also think it is important to distinguish
> between codecs not supported in transport streams and codecs
> that are supported but support is not implemented in FFmpeg.
>
> Please comment, Carl Eugen
> mpegtsenc.c | 38 ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 38 insertions(+)
> e1e90eb9e99ccd0c74f024ce9ae6c4ff8dcf9234 patchmpegts.diff
> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index f773019..9571789 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -608,6 +608,44 @@ static int mpegts_write_header(AVFormatContext *s)
> int *pids;
> int ret;
>
> + for (i = 0; i < s->nb_streams; i++) {
> + st = s->streams[i];
> + if (st->codec->codec_type == AVMEDIA_TYPE_DATA ||
> + st->codec->strict_std_compliance <= FF_COMPLIANCE_EXPERIMENTAL)
> + continue;
> + switch (st->codec->codec_id) {
> + case AV_CODEC_ID_CAVS:
> + case AV_CODEC_ID_DIRAC:
> + case AV_CODEC_ID_H264:
> + case AV_CODEC_ID_MPEG1VIDEO:
> + case AV_CODEC_ID_MPEG2VIDEO:
> + case AV_CODEC_ID_MPEG4:
> + case AV_CODEC_ID_AAC:
> + case AV_CODEC_ID_AAC_LATM:
> + case AV_CODEC_ID_AC3:
> + case AV_CODEC_ID_DTS:
> + case AV_CODEC_ID_EAC3:
> + case AV_CODEC_ID_MP2:
> + case AV_CODEC_ID_MP3:
> + case AV_CODEC_ID_S302M:
> + case AV_CODEC_ID_DVB_SUBTITLE:
> + case AV_CODEC_ID_DVB_TELETEXT:
> + continue;
> + }
> + switch (st->codec->codec_id) {
> + case AV_CODEC_ID_VC1:
> + case AV_CODEC_ID_TRUEHD:
> + case AV_CODEC_ID_PCM_BLURAY:
> + case AV_CODEC_ID_HDMV_PGS_SUBTITLE:
> + av_log(s, AV_LOG_ERROR, "Muxing %s in transport streams is not yet implemented, use -strict experimental to write invalid files\n",
> + avcodec_get_name(st->codec->codec_id));
> + return AVERROR_PATCHWELCOME;
> + }
> + av_log(s, AV_LOG_ERROR, "Codec %s not supported in transport streams, use -strict experimental to write invalid files\n",
> + avcodec_get_name(st->codec->codec_id));
> + return AVERROR(EINVAL);
> + }
can this be in AVOutputFormat.query_codec() ?
because it would fit better there even if its called from
mpegts_write_header() instead of a generic place
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato
-------------- 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/20140608/27a6d526/attachment.asc>
More information about the ffmpeg-devel
mailing list