Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#3634 closed defect (fixed)

asfenc: too many payloads in a packet

Reported by: atgraham Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: asf
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description (last modified by cehoyos)

In the ASF specification:

the section on Multiple payloads ( 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)
@@ -819,8 +818,6 @@
         else if (asf->packet_size_left <= (PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS + PACKET_HEADER_MIN_SIZE + 1))
-        else if (asf->packet_nb_payloads == ASF_PAYLOADS_PER_PACKET)
-            flush_packet(s);

Attachments (1)

silence.m4a (17.1 KB) - added by atgraham 6 years ago.
Use the ffmpeg command to remux this file to ASF to see the problem

Download all attachments as: .zip

Change History (3)

Changed 6 years ago by atgraham

Use the ffmpeg command to remux this file to ASF to see the problem

comment:1 Changed 6 years ago by michael

  • Reproduced by developer set
  • Resolution set to fixed
  • Status changed from new to closed

comment:2 Changed 6 years ago by cehoyos

  • Description modified (diff)
  • Keywords asf added
  • Version changed from unspecified to git-master
Note: See TracTickets for help on using tickets.