[FFmpeg-devel] [PATCH] dash: change default MP4 extension to .m4s
Jeyapal, Karthick
kjeyapal at akamai.com
Thu Jun 20 06:19:35 EEST 2019
On 6/19/19 3:08 PM, Alfred E. Heggestad wrote:
> On 19/06/2019 07:21, Jeyapal, Karthick wrote:
>>
>> On 6/18/19 1:48 PM, Alfred E. Heggestad wrote:
>>> On 18/06/2019 04:02, Steven Liu wrote:
>>>> Alfred E. Heggestad <alfred.heggestad at gmail.com> 于2019年6月17日周一 下午4:02写道:
>>>>>
>>>>> From 923da82598bddd1ed05750427dbc71e607d296a2 Mon Sep 17 00:00:00 2001
>>>>> From: "Alfred E. Heggestad" <alfred.heggestad at gmail.com>
>>>>> Date: Mon, 17 Jun 2019 09:59:04 +0200
>>>>> Subject: [PATCH] dash: change default MP4 extension to .m4s
>>>>>
>>>>> this was changed in commit 281a21ed50849e3c8c0d03005230e9fd07c24370
>>>>> ---
>>>>> libavformat/dashenc.c | 2 +-
>>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
>>>>> index 3fd7e78166..a51a1da0ca 100644
>>>>> --- a/libavformat/dashenc.c
>>>>> +++ b/libavformat/dashenc.c
>>>>> @@ -166,7 +166,7 @@ static struct format_string {
>>>>> const char *str;
>>>>> } formats[] = {
>>>>> { SEGMENT_TYPE_AUTO, "auto" },
>>>>> - { SEGMENT_TYPE_MP4, "mp4" },
>>>>> + { SEGMENT_TYPE_MP4, "m4s" },
>>>>> { SEGMENT_TYPE_WEBM, "webm" },
>>>>> { 0, NULL }
>>>>> };
>>>>> --
>>>>> 2.20.1 (Apple Git-117)
>>>>>
>>>>> _______________________________________________
>>>>> ffmpeg-devel mailing list
>>>>> ffmpeg-devel at ffmpeg.org
>>>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>>>
>>>>> To unsubscribe, visit link above, or email
>>>>> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>>>>
>>>>
>>>>
>>>> LGTM
>>>>
>>>
>>> the background for this is the extension for DASH media files
>>> used to be *.m4s and it is now *.mp4
>>>
>>>
>>> the patch is a suggestion and should be checked by the DASH experts
>>>
>>> what is correct according to the standard ?
>>>
>>> the media-file is not really an .mp4 file, it cannot be
>>> played with e.g. ffplay:
>>>
>>> $ ffplay chunk-stream1-00001.m4s
>> Thanks for submitting the patch. I agree that m4s should be extension for media segments.
>> mp4 should be used only for complete files.
>> With respect to the patch, dashenc generates either multiple segments or a single file(with byte range as segments) based on "single_file" option.
>> The default of mp4 is correct when "single_file" is enabled. But it is wrong when "single_file" is disabled. The proposed patch just reverses this situation.
>> I would suggest the patch should handle both cases correctly.
>
> Hi,
>
> many thanks for your review comments.
>
> I have updated the patch based on your comments, please see below.
>
>
> this code works in my application (both single and multi files)
> but the code should be reviewed by someone who has better
> knowledge with the code.
Thanks for sending a revised patch promptly.
I think your patch below might adversely affect the following code
avio_printf(out, "\t\t\t<Representation id=\"%d\" mimeType=\"video/%s\" codecs=\"%s\"%s width=\"%d\" height=\"%d\"",
i, os->format_name, os->codec_str, bandwidth_str, s->streams[i]->codecpar->width, s->streams[i]->codecpar->height);
mimetype will become "video/m4s" for if the file extension is m4s. But I am not sure if it is correct or if such a mimetype exists.
I guess mimetype should remain as "video/mp4" even if the file extension is m4s.
Please let me know your views on this.
>
>
> ...
>
>
>
> From 2059bfad56eadbccee968cc34dd594089a1e8984 Mon Sep 17 00:00:00 2001
> From: "Alfred E. Heggestad" <alfred.heggestad at gmail.com>
> Date: Wed, 19 Jun 2019 11:33:13 +0200
> Subject: [PATCH] dash: change default MP4 extension to .m4s
>
> ---
> libavformat/dashenc.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index 3fd7e78166..a60547ef0d 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -250,6 +250,10 @@ static int init_segment_types(AVFormatContext *s)
> c->segment_type_option, s->streams[i]->codecpar->codec_id);
> os->segment_type = segment_type;
> os->format_name = get_format_str(segment_type);
> +
> + if (segment_type == SEGMENT_TYPE_MP4 && !c->single_file)
> + os->format_name = "m4s";
> +
> if (!os->format_name) {
> av_log(s, AV_LOG_ERROR, "Could not select DASH segment
> type for stream %d\n", i);
> return AVERROR_MUXER_NOT_FOUND;
> @@ -1210,7 +1214,7 @@ static int dash_init(AVFormatContext *s)
> }
> }
>
> - ctx->oformat = av_guess_format(os->format_name, NULL, NULL);
> + ctx->oformat =
> av_guess_format(get_format_str(os->segment_type), NULL, NULL);
> if (!ctx->oformat)
> return AVERROR_MUXER_NOT_FOUND;
> os->ctx = ctx;
More information about the ffmpeg-devel
mailing list