Opened 3 years ago

Closed 3 years ago

#4971 closed defect (invalid)

ffmpeg can not slice when i use HLS

Reported by: hiccupzhu Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
How to reproduce:

ffmpeg -i /mnt/hgfs/F/manga.01.ts -vcodec copy -bsf:v h264_mp4toannexb -hls_list_size 0 -hls_segment_filename "test_%04d.ts" playlist.m3u8

szhu@vm1504:/opt/source/ffmpeg$ ./ffmpeg -version
ffmpeg version N-76338-g54cd1ab Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.2 (Ubuntu 4.9.2-10ubuntu13)
configuration: 
libavutil      55.  5.100 / 55.  5.100
libavcodec     57. 12.100 / 57. 12.100
libavformat    57. 11.100 / 57. 11.100
libavdevice    57.  0.100 / 57.  0.100
libavfilter     6. 14.101 /  6. 14.101
libswscale      4.  0.100 /  4.  0.100
libswresample   2.  0.100 /  2.  0.100

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (1)

manga.01.ts (2.0 MB) - added by hiccupzhu 3 years ago.
The attachment is problem file.

Download all attachments as: .zip

Change History (8)

Changed 3 years ago by hiccupzhu

The attachment is problem file.

comment:1 Changed 3 years ago by cehoyos

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

For future tickets: Please remember to not only post the command line that allows to reproduce the issue (or the command line and the license header) but to always post the command line together with the complete, uncut console output.

Remove the bitstream filter from your command line and please remember that this is a bug tracker, there is a user mailing list for usage questions.

comment:2 Changed 3 years ago by hiccupzhu

Sorry, this is my first commit problem.
This problem reproduce simple, you can download the attachment "manga.01.ts".
Then run:

ffmpeg -i ./manga.01.ts -vcodec copy -bsf:v h264_mp4toannexb -hls_list_size 0 -hls_segment_filename "test_%04d.ts" playlist.m3u8

You will be found the file can not be sliced. I follow some sourcecode, found ffmpeg can not set the I-frame infomation(AV_PKT_FLAG_KEY).

Console output:

ffmpeg version 2.8.1 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (Ubuntu 4.9.2-10ubuntu13)
  configuration: --enable-libfaac --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-gpl --enable-nonfree --enable-libmp3lame
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mpegts, from '/mnt/hgfs/F/manga.01.ts':
  Duration: 00:00:13.40, start: 1.480000, bitrate: 1252 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 720x544 [SAR 136:135 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x101](und): Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 43 kb/s
Output #0, hls, to 'output/playlist.m3u8':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0: Video: h264 ([27][0][0][0] / 0x001B), yuv420p, 720x544 [SAR 136:135 DAR 4:3], q=2-31, 25 fps, 25 tbr, 90k tbn, 25 tbc
    Stream #0:1(und): Audio: aac ([15][0][0][0] / 0x000F), 44100 Hz, stereo, 43 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[NULL @ 0x3130660] Packet header is not contained in global extradata, corrupted stream or invalid MP4/AVCC bitstream
frame=  335 fps=0.0 q=-1.0 Lsize=N/A time=00:00:13.32 bitrate=N/A    
video:1798kB audio:62kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

comment:3 Changed 3 years ago by hiccupzhu

  • Resolution invalid deleted
  • Status changed from closed to reopened

comment:4 Changed 3 years ago by cehoyos

  • Resolution set to invalid
  • Status changed from reopened to closed

Please ask all usage questions on the user mailing list.

comment:5 Changed 3 years ago by hiccupzhu

I have FIXED this bug, and ffmpeg can work normally.

diff --git a/ffmpeg.c b/ffmpeg.c
index f91fb7b..22766b3 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3864,6 +3864,9 @@ static int process_input(int file_index)
     if (pkt.dts != AV_NOPTS_VALUE)
         pkt.dts *= ist->ts_scale;
 
+    if(pkt.pts == AV_NOPTS_VALUE)
+        pkt.pts = ist->next_pts;
+
     if ((ist->dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO ||
          ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) &&
         pkt.dts != AV_NOPTS_VALUE && ist->next_dts == AV_NOPTS_VALUE && !copy_ts

comment:6 Changed 3 years ago by hiccupzhu

  • Resolution invalid deleted
  • Status changed from closed to reopened

comment:7 Changed 3 years ago by cehoyos

  • Resolution set to invalid
  • Status changed from reopened to closed

Please send your patch (with an explanation) to the development mailing list where patches are discussed. Patches on this bug tracker are ignored.

Note: See TracTickets for help on using tickets.