[Libav-user] Writing movie files written with AV_CODEC_ID_MPEG4 with ffmpeg 1.1 and higher

GUYER Sacha sacha at bitplane.com
Mon Nov 28 10:54:08 EET 2016


Hi,

I am writing mp4/mov files (AV_CODEC_ID_MPEG4) and have issues playing
them with
Quicktime for MAC with newer versions of ffmpeg.

With ffmpeg version 1.0.10 this works fine, but with ffmpeg version 1.1.16
or higher
(I tested 1.2, 3.0, 3.2), Quicktime only shows the first and the last
frame of the movie,
and the duration is less than a second. The file plays fine in VLC player
or Windows Media Player.

I used the same code to create the movie for ffmpeg 1.0.10 and 1.1.16
(only changed CODEC_ID_MPEG to AV_CODEC_ID_MPEG4, CodecID to AVCodecID,
PixelFormat to AVPixelFormat etc.)

This is the ffprobe output for the "good" file created by ffmpeg 1.0.10:
---
ffprobe version 3.2 Copyright (c) 2007-2016 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2 --enable-shared
--enable-pthreads
    --enable-gpl --enable-version3 --enable-hardcoded-tables
--enable-avresample --cc=clang
    --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264
--enable-libxvid
    --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 34.100 / 55. 34.100
  libavcodec     57. 64.100 / 57. 64.100
  libavformat    57. 56.100 / 57. 56.100
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test_ffmpeg1_0_10.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    title           : retina
    encoder         : Lavf54.29.104
    comment         : Creation Date: 2016-11-28 08:49:37.320
  Duration: 00:00:04.17, start: 0.000000, bitrate: 8690 kb/s
    Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D),
yuv420p,
      852x697 [SAR 1:1 DAR 852:697], 8688 kb/s, 24 fps, 24 tbr, 24 tbn, 24
tbc (default)
    Metadata:
      handler_name    : VideoHandler
---

This is the ffprobe output for the "bad" file created by ffmpeg 1.1.16:
--- 
ffprobe version 3.2 Copyright (c) 2007-2016 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2 --enable-shared
--enable-pthreads
    --enable-gpl --enable-version3 --enable-hardcoded-tables
--enable-avresample --cc=clang
    --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264
--enable-libxvid
    --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 34.100 / 55. 34.100
  libavcodec     57. 64.100 / 57. 64.100
  libavformat    57. 56.100 / 57. 56.100
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test_ffmpeg1_1_16.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    title           : retina
    encoder         : Lavf54.59.106
    comment         : Creation Date: 2016-11-28 08:42:14.650
  Duration: 00:00:00.05, start: 0.000000, bitrate: 724386 kb/s
    Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D),
yuv420p,
      852x697 [SAR 1:1 DAR 852:697], 728053 kb/s, 2011.13 fps, 12288 tbr,
12288 tbn, 24 tbc (default)
    Metadata:
      handler_name    : VideoHandler
---

The duration bitrate and many other properties look bad.

Apparently the code that worked in ffmpeg 1.0.10 does not work in 1.1.16
and higher.
I don't know why and I did not find any documentation about what to change
to make it ffmpeg 1.1 compliant.
I also did not find any sample code that writes a movie file with
AV_CODEC_ID_MPEG4.
I tried adjusting the example code at doc/examples/decoding_encoding.c to
write AV_CODEC_ID_MPEG4,
but it did not produce a valid file.

Note: With the same code, I could successfully write movie files with the
following codecs:
AV_CODEC_ID_MSMPEG4V2
AV_CODEC_ID_FLV1
AV_CODEC_ID_MPEG1VIDEO
AV_CODEC_ID_RAWVIDEO
AV_CODEC_ID_WMV1

Can someone point me to sample code that uses AV_CODEC_ID_MPEG4, or give
me some hints what could be wrong
with how I write the file?

Thank you

Sacha Guyer





___________________________________________________________________________This e-mail is confidential and is for the addressee only.  Please refer to www.oxinst.com/email-statement for regulatory information.


More information about the Libav-user mailing list