Opened 6 years ago

Closed 3 years ago

#6887 closed defect (fixed)

segfault copying MPEGTS to MPEG with subtitles

Reported by: a.m. Owned by:
Priority: important Component: avformat
Version: git-master Keywords: mpegps mpegts crash SIGSEGV regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

How to reproduce:

% ffmpeg_g -report -i HOLE_orig.ts -map 0:0 -map 0:1 -map 0:2 -map 0:3  -c:v copy -c:a copy -c:s copy -f mpeg          HOLE.mpeg

ffmpeg GIT version

 00d454ed2c lavf/movenc: add sdtp (sample dependency) box

it was built with

  ./configure --prefix=$HOME/install/ffmpeg  --enable-libx264  --enable-gpl --enable-libmp3lame --enable-libvorbis  --enable-libzvbi --enable-libass

Please look in
this link for all files:

  • the HOLE_orig.ts file
  • GDB "bt" , "disass $pc-32,$pc+32" and "info all-registers"
  • typescript of build
  • the file generated by -report

thanks

Attachments (1)

HOLE_orig_cut.ts (2.4 MB ) - added by Carl Eugen Hoyos 6 years ago.

Change History (7)

comment:1 by Carl Eugen Hoyos, 6 years ago

Component: ffmpegavformat
Keywords: mpegps crash SIGSEGV regression added
Priority: normalimportant
Reproduced by developer: set
Status: newopen

For future tickets: Please remember to post all necessary information here in the ticket, do not use external resources (except for large input files).

Regression since a7bb12a307568c0db72e6eb8d496a5651a8228df

(gdb) r -i HOLE_orig_cut.ts -vcodec copy -acodec copy -scodec copy out.mpg
Starting program: ffmpeg_g -i HOLE_orig_cut.ts -vcodec copy -acodec copy -scodec copy out.mpg
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
ffmpeg version N-89361-g225341b Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.0 (GCC)
  configuration: --enable-gpl
  libavutil      56.  4.100 / 56.  4.100
  libavcodec     58.  6.102 / 58.  6.102
  libavformat    58.  2.103 / 58.  2.103
  libavdevice    58.  0.100 / 58.  0.100
  libavfilter     7.  6.100 /  7.  6.100
  libswscale      5.  0.101 /  5.  0.101
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.100
[mpegts @ 0x206b3e0] PES packet size mismatch
    Last message repeated 3 times
[mpegts @ 0x206b3e0] Could not find codec parameters for stream 4 (Unknown: none ([5][0][0][0] / 0x0005)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 0x206b3e0] Could not find codec parameters for stream 5 (Unknown: none ([5][0][0][0] / 0x0005)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 0x206b3e0] Could not find codec parameters for stream 6 (Unknown: none ([5][0][0][0] / 0x0005)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 0x206b3e0] Could not find codec parameters for stream 7 (Unknown: none ([5][0][0][0] / 0x0005)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 0x206b3e0] Could not find codec parameters for stream 8 (Unknown: none ([11][0][0][0] / 0x000B)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 0x206b3e0] Could not find codec parameters for stream 9 (Unknown: none ([11][0][0][0] / 0x000B)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 0x206b3e0] Could not find codec parameters for stream 10 (Unknown: none ([11][0][0][0] / 0x000B)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 0x206b3e0] Could not find codec parameters for stream 11 (Unknown: none ([12][0][0][0] / 0x000C)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'HOLE_orig_cut.ts':
  Duration: 09:42:39.40, start: 93192.547378, bitrate: 0 kb/s
  Program 4006
    Stream #0:0[0x654]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x655](ita): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s
    Stream #0:2[0x656](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 128 kb/s
    Stream #0:3[0x653](ita,ita): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
    Stream #0:4[0x1ea0]: Unknown: none ([5][0][0][0] / 0x0005)
    Stream #0:5[0x1ea1]: Unknown: none ([5][0][0][0] / 0x0005)
    Stream #0:6[0x1ea2]: Unknown: none ([5][0][0][0] / 0x0005)
    Stream #0:7[0x1eaa]: Unknown: none ([5][0][0][0] / 0x0005)
    Stream #0:8[0x1e78]: Unknown: none ([11][0][0][0] / 0x000B)
    Stream #0:9[0x1e79]: Unknown: none ([11][0][0][0] / 0x000B)
    Stream #0:10[0x1e83]: Unknown: none ([11][0][0][0] / 0x000B)
    Stream #0:11[0x1ed3]: Unknown: none ([12][0][0][0] / 0x000C)
[mpeg @ 0x20fb240] VBV buffer size not set, using default size of 130KB
If you want the mpeg file to be compliant to some specification
Like DVD, VCD or others, make sure you set the correct buffer size
Output #0, mpeg, to 'out.mpg':
  Metadata:
    encoder         : Lavf58.2.103
    Stream #0:0: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], q=2-31, 25 fps, 25 tbr, 90k tbn, 25 tbc
    Stream #0:1(ita): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 192 kb/s
    Stream #0:2(ita,ita): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #0:3 -> #0:2 (copy)
Press [q] to stop, [?] for help

Program received signal SIGSEGV, Segmentation fault.
get_nb_frames (ctx=0x20fb240, stream=0x20efe40, len=39) at libavformat/mpegenc.c:586
586             if (pkt_desc->size == pkt_desc->unwritten_size)
(gdb) bt
#0  get_nb_frames (ctx=0x20fb240, stream=0x20efe40, len=39) at libavformat/mpegenc.c:586
#1  flush_packet (ctx=ctx@entry=0x20fb240, stream_index=stream_index@entry=2, pts=165054, dts=165054, scr=<optimized out>,
    scr@entry=143743, trailer_size=trailer_size@entry=257) at libavformat/mpegenc.c:796
#2  0x00000000006b08cc in output_packet (flush=0, ctx=0x20fb240) at libavformat/mpegenc.c:1066
#3  mpeg_mux_write_packet (ctx=0x20fb240, pkt=<optimized out>) at libavformat/mpegenc.c:1176
#4  0x00000000006c14ed in write_packet (pkt=0x7fffffffcfd0, s=0x20fb240) at libavformat/mux.c:754
#5  av_interleaved_write_frame (s=s@entry=0x20fb240, pkt=0x0, pkt@entry=0x7fffffffd3f0) at libavformat/mux.c:1245
#6  0x000000000049d81c in write_packet (pkt=pkt@entry=0x7fffffffd3f0, ost=ost@entry=0x20adb80, unqueue=unqueue@entry=0,
    of=<optimized out>, of=<optimized out>) at fftools/ffmpeg.c:807
#7  0x000000000049ec05 in output_packet (of=of@entry=0x206f840, pkt=pkt@entry=0x7fffffffd3f0, ost=ost@entry=0x20adb80, eof=0)
    at fftools/ffmpeg.c:878
#8  0x00000000004a3922 in do_streamcopy (pkt=<optimized out>, ost=<optimized out>, ist=<optimized out>) at fftools/ffmpeg.c:2075
#9  process_input_packet (ist=0x2099d60, pkt=0x7fffffffd7c0, no_eof=<optimized out>) at fftools/ffmpeg.c:2744
#10 0x0000000000481428 in process_input (file_index=<optimized out>) at fftools/ffmpeg.c:4463
#11 transcode_step () at fftools/ffmpeg.c:4583
#12 transcode () at fftools/ffmpeg.c:4637
#13 main (argc=<optimized out>, argv=<optimized out>) at fftools/ffmpeg.c:4843
(gdb) disass $pc-32,$pc+32
Dump of assembler code from 0x6afa50 to 0x6afa90:
   0x00000000006afa50 <flush_packet+1104>:      in     (%dx),%eax
   0x00000000006afa51 <flush_packet+1105>:      mov    %r13d,0x20(%rsp)
   0x00000000006afa56 <flush_packet+1110>:      mov    0x20(%rax),%rax
   0x00000000006afa5a <flush_packet+1114>:      jle    0x6b019d <flush_packet+2973>
   0x00000000006afa60 <flush_packet+1120>:      mov    %r13d,%edx
   0x00000000006afa63 <flush_packet+1123>:      xor    %r13d,%r13d
   0x00000000006afa66 <flush_packet+1126>:      nopw   %cs:0x0(%rax,%rax,1)
=> 0x00000000006afa70 <flush_packet+1136>:      mov    0x14(%rax),%ecx
   0x00000000006afa73 <flush_packet+1139>:      xor    %esi,%esi
   0x00000000006afa75 <flush_packet+1141>:      cmp    %ecx,0x10(%rax)
   0x00000000006afa78 <flush_packet+1144>:      mov    0x18(%rax),%rax
   0x00000000006afa7c <flush_packet+1148>:      sete   %sil
   0x00000000006afa80 <flush_packet+1152>:      sub    %ecx,%edx
   0x00000000006afa82 <flush_packet+1154>:      add    %esi,%r13d
   0x00000000006afa85 <flush_packet+1157>:      test   %edx,%edx
   0x00000000006afa87 <flush_packet+1159>:      jg     0x6afa70 <flush_packet+1136>
   0x00000000006afa89 <flush_packet+1161>:      mov    0x20(%rbx),%rdi
   0x00000000006afa8d <flush_packet+1165>:      mov    0x3c(%rsp),%esi
End of assembler dump.
(gdb) info register
rax            0x0      0
rbx            0x20fb240        34583104
rcx            0x240    576
rdx            0x27     39
rsi            0x1      1
rdi            0x20738c0        34027712
rbp            0x208ef20        0x208ef20
rsp            0x7fffffffcd80   0x7fffffffcd80
r8             0xdd10   56592
r9             0x101    257
r10            0x36a8   13992
r11            0x7ffff54cad60   140737308831072
r12            0x0      0
r13            0x3      3
r14            0x0      0
r15            0x1      1
rip            0x6afa70 0x6afa70 <flush_packet+1136>
eflags         0x10206  [ PF IF RF ]
cs             0x33     51
ss             0x2b     43
ds             0x0      0
es             0x0      0
fs             0x0      0
gs             0x0      0

by Carl Eugen Hoyos, 6 years ago

Attachment: HOLE_orig_cut.ts added

comment:2 by a.m., 6 years ago

Component: avformatffmpeg
Keywords: mpegps crash SIGSEGV regression removed
Priority: importantnormal
Reproduced by developer: unset

hi, I added the output of Valgrind. a.

comment:3 by a.m., 6 years ago

Dear cehoyos I am very sorry. I added a comment at the same time you were modifying this bug report. Somehow this changed a lot of metadata as well... it removed keywords, flags, .. Very sorry. a.

comment:4 by a.m., 6 years ago

Component: ffmpegavformat
Keywords: mpegps mpegts crash SIGSEGV regression added
Priority: normalimportant
Reproduced by developer: set

comment:5 by colin ng, 6 years ago

-scodec copy option has not been implemented in do_streamcopy() over the master branch. The transcoding does work without "-scodec copy".

comment:6 by mkver, 3 years ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.