Opened 6 years ago

Last modified 6 years ago

#7553 new defect

start_time / start_pts is wrong for AAC in MOV

Reported by: shekh Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: AAC
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

(maybe in other containers too)

AVStream.start_time is set to 0 but the first packet pts is -1024
If would be helpful if start_time was either correct (-1024) or undefined. The value 0 is confusing.

How to reproduce:

ffmpeg.exe -i src1.avi -vcodec copy -acodec aac -b:a 128k test.mov

ffmpeg version N-92462-g529debc987 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20181017
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 23.101 / 56. 23.101
  libavcodec     58. 39.100 / 58. 39.100
  libavformat    58. 22.100 / 58. 22.100
  libavdevice    58.  6.100 / 58.  6.100
  libavfilter     7. 44.100 /  7. 44.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, avi, from 'src1.avi':
  Duration: 00:00:05.01, start: 0.000000, bitrate: 3383 kb/s
    Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), yuv422p10le, 124x70, 1837 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
File 'test.mov' already exists. Overwrite ? [y/N] Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, mov, to 'test.mov':
  Metadata:
    encoder         : Lavf58.22.100
    Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), yuv422p10le, 124x70, q=2-31, 1837 kb/s, 23.98 fps, 23.98 tbr, 11988 tbn, 23.98 tbc
    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc58.39.100 aac
frame=  120 fps=0.0 q=-1.0 Lsize=    1196kB time=00:00:05.01 bitrate=1954.5kbits/s speed=37.7x    
video:1113kB audio:79kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.336603%
[aac @ 000000000050b980] Qavg: 178.232
ffprobe.exe test.mov -select_streams a:0 -show_packets -show_streams >test.txt

ffprobe version N-92462-g529debc987 Copyright (c) 2007-2018 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20181017
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 23.101 / 56. 23.101
  libavcodec     58. 39.100 / 58. 39.100
  libavformat    58. 22.100 / 58. 22.100
  libavdevice    58.  6.100 / 58.  6.100
  libavfilter     7. 44.100 /  7. 44.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf58.22.100
  Duration: 00:00:05.03, start: 0.000000, bitrate: 1949 kb/s
    Stream #0:0(eng): Video: ffv1 (FFV1 / 0x31564646), yuv422p10le, 124x70, 1822 kb/s, 23.98 fps, 23.98 tbr, 11988 tbn, 11988 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

Attachments (2)

src1.avi (2.0 MB ) - added by shekh 6 years ago.
test.txt (57.3 KB ) - added by shekh 6 years ago.

Change History (4)

by shekh, 6 years ago

Attachment: src1.avi added

by shekh, 6 years ago

Attachment: test.txt added

comment:1 by Carl Eugen Hoyos, 6 years ago

What exactly is the issue here? Is the output file broken? How can I reproduce?

comment:2 by shekh, 6 years ago

This is minor issue.
I used AVStream.start_time to calculate target position for seeking. It turns out start_time is not useful for this and I need to extract it myself by reading packets and other guesswork.

Decoding: pts of the first frame of the stream in presentation order, in stream time base.

Just noticed the word "frame" (vs packet). Does it mean the packet at pts -1024 results in completely discarded frame which does not count as "true start" now?
If I seek to start_time (0) the next frame will be discarded too, so the first frame I actually get will have pts=1024. This is confusing.

Note: See TracTickets for help on using tickets.