mbox series

[FFmpeg-devel,v4,0/5] AMV muxing and adpcm_ima_amv encoding support

Message ID 20201105134827.25564-1-zane@zanevaniperen.com
Headers show
Series AMV muxing and adpcm_ima_amv encoding support | expand

Message

Zane van Iperen Nov. 5, 2020, 1:48 p.m. UTC
Adds support for encoding to adpcm_ima_amv and muxing to AMV.

Things to note:
- AMV is a hard-coded (and broken) subset of AVI. It's not worth sullying the
  existing AVI muxer with its filth.
- The muxer is extremely pedantic about its streams, this is to
  not break certain software players.
- The sizes of certain tags are deliberately set to 0 as some players break
  when they're set correctly. Ditto with some header fields.
- Players can be **very** sensitive to the frame order and sizes.
  - Frames must be strictly interleaved as V-A, any V-V or A-A will
    cause crashes.
  - Variable audio frame sizes cause crashes.
  - If audio is shorter than video, it's padded with silence.
  - If video is shorter than audio, the most recent frame is repeated.

v4:
  - Always use the coded sample count if its a sensible value
  - Fix decoder odd sample check

v3: [2]
 - Use ffio_fill()

v2: [1]
 - Unref allocated audio frame
 - Check return value of av_packet_ref()
 - Remove unnecessary initialisations
 - Add deinit() function

[1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-November/271837.html
[2]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-November/271882.html

Zane van Iperen (5):
  avcodec/adpcm_ima_amv: restrict to 1 channel
  avcodec/adpcm_ima_amv: use coded sample count
  avcodec/adpcm_ima_amv: document header format
  avcodec: add adpcm_ima_amv encoder
  avformat: add amv muxer

 MAINTAINERS                  |   1 +
 doc/general_contents.texi    |   2 +-
 libavcodec/adpcm.c           |  34 ++-
 libavcodec/adpcmenc.c        |  58 ++++-
 libavcodec/allcodecs.c       |   1 +
 libavcodec/utils.c           |   3 +-
 libavformat/Makefile         |   1 +
 libavformat/allformats.c     |   1 +
 libavformat/amvenc.c         | 413 +++++++++++++++++++++++++++++++++++
 tests/ref/fate/adpcm-ima-amv | 312 +++++++++++++-------------
 10 files changed, 665 insertions(+), 161 deletions(-)
 create mode 100644 libavformat/amvenc.c

Comments

Zane van Iperen Nov. 6, 2020, 1:56 a.m. UTC | #1
On 5/11/20 11:48 pm, Zane van Iperen wrote:
> Adds support for encoding to adpcm_ima_amv and muxing to AMV.
> 
> Things to note:
> - AMV is a hard-coded (and broken) subset of AVI. It's not worth sullying the
>    existing AVI muxer with its filth.
> - The muxer is extremely pedantic about its streams, this is to
>    not break certain software players.
> - The sizes of certain tags are deliberately set to 0 as some players break
>    when they're set correctly. Ditto with some header fields.
> - Players can be **very** sensitive to the frame order and sizes.
>    - Frames must be strictly interleaved as V-A, any V-V or A-A will
>      cause crashes.
>    - Variable audio frame sizes cause crashes.
>    - If audio is shorter than video, it's padded with silence.
>    - If video is shorter than audio, the most recent frame is repeated.
> 
> v4:
>    - Always use the coded sample count if its a sensible value
>    - Fix decoder odd sample check
> 
> v3: [2]
>   - Use ffio_fill()
> 
> v2: [1]
>   - Unref allocated audio frame
>   - Check return value of av_packet_ref()
>   - Remove unnecessary initialisations
>   - Add deinit() function
> 
> [1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-November/271837.html
> [2]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-November/271882.html

Ping. Will apply in a few days.