Opened 6 years ago

Closed 5 years ago

#1572 closed defect (fixed)

HLS input destroys DTS/PTS information

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

Description (last modified by cehoyos)

When using an HLS as input, ffmpeg does not preserve the DTS timestamps which are usually present whenever B-frames are present. For simplicity, I chosen flv output because is very easy to eye-ball the resulted file in a hex editor and determine if a file has or has not dts timestamps.

How to reproduce:

method 1 (DTS timestamps are destroyed/absent)

% ffmpeg -i -an -vcodec copy /tmp/a.flv

method 2 (DTS timestamps are preserved/present)

% ffmpeg -i -an -vcodec copy /tmp/a.flv


  1. all.ts input file is nothing more nothing less than all the chunks concatenated from test.m3u8. Basically, identical content. Logically speaking, both methods should generate proper DTS timestamps (I don't expect them to be identical, but at least present). Why? because both methods are in the end falling back on mpegts demuxer. I think the problem is somewhere in libavformat/hls.c
  2. I removed the audio track for simplicity
  3. ffplay will playback just fine both resulted files (flv files). However, flash player - the primary consumer of those files - will choke on the one with bogus DTS. And it makes sense, because the file is not adhering to the FLV specs.

My ffmpeg version is:

ffmpeg version 0.11.1.git
built on Jul 24 2012 04:23:34 with llvm-gcc 4.2.1 (LLVM build 2336.9.00)
configuration: --enable-libx264 --enable-libfaac --enable-gpl --enable-nonfree --enable-libmp3lame --enable-shared --disable-filter=mp --prefix=/Users/shiretu/work/ffmpeg_bin
libavutil      51. 65.100 / 51. 65.100
libavcodec     54. 44.100 / 54. 44.100
libavformat    54. 20.100 / 54. 20.100
libavdevice    54.  2.100 / 54.  2.100
libavfilter     3.  3.100 /  3.  3.100
libswscale      2.  1.100 /  2.  1.100
libswresample   0. 15.100 /  0. 15.100
libpostproc    52.  0.100 / 52.  0.100

Change History (7)

comment:1 Changed 6 years ago by crtmpserver

sorry about "fly". It should be FLV. The spellchecker ...

comment:2 Changed 5 years ago by michael

testing current git master, both flv files generated contain some frames with dts != pts. Does this problem still occur? and if so, please show an example of bad dts values. Note you can easily see them, with -fdebug ts -debug_ts

comment:3 Changed 5 years ago by cehoyos

  • Keywords hls added

comment:4 Changed 5 years ago by cehoyos

  • Description modified (diff)

comment:5 Changed 5 years ago by cehoyos

  • Description modified (diff)

comment:6 Changed 5 years ago by crtmpserver

I believe this was fixed a good while ago. Just that the ticket wasn't closed at the fix-time.

Best regards,

comment:7 Changed 5 years ago by cehoyos

  • Component changed from undetermined to avformat
  • Reproduced by developer set
  • Resolution set to fixed
  • Status changed from new to closed
  • Version changed from unspecified to git-master

Fixed by Michael in 6f61823.

Note: See TracTickets for help on using tickets.