[FFmpeg-trac] #3634(avformat:closed): asfenc: too many payloads in a packet
FFmpeg
trac at avcodec.org
Tue May 13 01:35:58 CEST 2014
#3634: asfenc: too many payloads in a packet
------------------------------------+------------------------------------
Reporter: atgraham | Owner:
Type: defect | Status: closed
Priority: normal | Component: avformat
Version: git-master | Resolution: fixed
Keywords: asf | Blocked By:
Blocking: | Reproduced by developer: 1
Analyzed by developer: 0 |
------------------------------------+------------------------------------
Changes (by cehoyos):
* keywords: => asf
* version: unspecified => git-master
Old description:
> In the ASF specification:
> http://www.microsoft.com/en-us/download/details.aspx?id=14995
>
> the section on Multiple payloads (5.2.3.3) describes the bit fields used
> to specify payload length type and number of payloads. The number of
> payloads field is a 6-bit field, meaning a packet can hold a maximum of
> 63 payloads.
>
> asfenc.c was not honoring this, and if more than 63 payloads would fit in
> a packet, the "number of payloads" field would overflow into the "payload
> length type" field, causing parsing errors in ffplay.
>
> You can reproduce this with any AAC file that has several seconds of
> silence in the beginning (lots of very small AAC frames). Use this ffmpeg
> command:
>
> $ ffmpeg -i silence.m4a -acodec copy silence.asf
>
> Note that ffplay will get lots of errors.
>
> Anyway, here's a patch to fix the problem. I already submitted this to
> ffmpeg-devel.
>
> diff -ur ffmpeg-mine/libavformat/asfenc.c
> ffmpeg-2.2.2/libavformat/asfenc.c
> --- ffmpeg-mine/libavformat/asfenc.c 2014-05-12 15:23:12.093259469
> -0700
> +++ ffmpeg-2.2.2/libavformat/asfenc.c 2014-05-04 21:14:52.000000000
> -0700
> @@ -34,7 +34,6 @@
>
> #define ASF_INDEXED_INTERVAL 10000000
> #define ASF_INDEX_BLOCK (1<<9)
> -#define ASF_PAYLOADS_PER_PACKET 63
>
> #define ASF_PACKET_ERROR_CORRECTION_DATA_SIZE 0x2
> #define ASF_PACKET_ERROR_CORRECTION_FLAGS \
> @@ -819,8 +818,6 @@
> flush_packet(s);
> else if (asf->packet_size_left <=
> (PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS + PACKET_HEADER_MIN_SIZE + 1))
> flush_packet(s);
> - else if (asf->packet_nb_payloads == ASF_PAYLOADS_PER_PACKET)
> - flush_packet(s);
> }
> stream->seq++;
> }
New description:
In the ASF specification:
http://www.microsoft.com/en-us/download/details.aspx?id=14995
the section on Multiple payloads (5.2.3.3) describes the bit fields used
to specify payload length type and number of payloads. The number of
payloads field is a 6-bit field, meaning a packet can hold a maximum of 63
payloads.
asfenc.c was not honoring this, and if more than 63 payloads would fit in
a packet, the "number of payloads" field would overflow into the "payload
length type" field, causing parsing errors in ffplay.
You can reproduce this with any AAC file that has several seconds of
silence in the beginning (lots of very small AAC frames). Use this ffmpeg
command:
$ ffmpeg -i silence.m4a -acodec copy silence.asf
Note that ffplay will get lots of errors.
Anyway, here's a patch to fix the problem. I already submitted this to
ffmpeg-devel.
{{{
diff -ur ffmpeg-mine/libavformat/asfenc.c
ffmpeg-2.2.2/libavformat/asfenc.c
--- ffmpeg-mine/libavformat/asfenc.c 2014-05-12 15:23:12.093259469
-0700
+++ ffmpeg-2.2.2/libavformat/asfenc.c 2014-05-04 21:14:52.000000000
-0700
@@ -34,7 +34,6 @@
#define ASF_INDEXED_INTERVAL 10000000
#define ASF_INDEX_BLOCK (1<<9)
-#define ASF_PAYLOADS_PER_PACKET 63
#define ASF_PACKET_ERROR_CORRECTION_DATA_SIZE 0x2
#define ASF_PACKET_ERROR_CORRECTION_FLAGS \
@@ -819,8 +818,6 @@
flush_packet(s);
else if (asf->packet_size_left <=
(PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS + PACKET_HEADER_MIN_SIZE + 1))
flush_packet(s);
- else if (asf->packet_nb_payloads == ASF_PAYLOADS_PER_PACKET)
- flush_packet(s);
}
stream->seq++;
}
}}}
--
--
Ticket URL: <https://trac.ffmpeg.org/ticket/3634#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list