Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#8451 closed defect (invalid)

Input seeking mpegts with copyts then "-to" generates 0kb result

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

Description

Summary of the bug:
How to reproduce:

D:\>ffmpeg -ss 00:00:30 -i b.ts -to 00:00:40 -c copy -copyts c.ts
ffmpeg version N-94960-g53d31e91c5 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.1.1 (GCC) 20190807
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --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-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 35.100 / 56. 35.100
  libavcodec     58. 57.100 / 58. 57.100
  libavformat    58. 32.104 / 58. 32.104
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 58.102 /  7. 58.102
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, mpegts, from 'b.ts':
  Duration: 00:01:00.50, start: 60.941333, bitrate: 14377 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709, top first), 1440x1080 [SAR 4:3 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x101](und): Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 255 kb/s
Output #0, mpegts, to 'c.ts':
  Metadata:
    encoder         : Lavf58.32.104
    Stream #0:0: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709, top first), 1440x1080 [SAR 4:3 DAR 16:9], q=2-31, 29.97 fps, 29.97 tbr, 90k tbn, 90k tbc
    Stream #0:1(und): Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 255 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=    0 fps=0.0 q=-1.0 Lsize=       0kB time=00:00:00.00 bitrate=N/A speed=   0x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Expected behavior: it cuts the video between 30 to 40 sec. And it works fine on mp4 videos.

(I followed the example here: http://trac.ffmpeg.org/wiki/Seeking )

However, for mpegts, it will result in a 0kb file.

Change History (2)

comment:1 by Carl Eugen Hoyos, 5 years ago

Resolution: invalid
Status: newclosed

Looking at the start time of the input and the to option it appears to me that FFmpeg acts as expected.

comment:2 by fireattack, 5 years ago

@cehoyos:

I see what you mean, and it does show "start: 60.941333".

However, AFAIK -copyts is the only way to cut videos with input seeking and nominal end time (-to) (instead of duration). Is there anyway to cut this kind of video without manually calculating the duration based on end-time? Because ffmpeg -ss 00:00:30 -i video.ts -to 00:00:40 will just cut from 30 to 1:10 instead.

Version 1, edited 5 years ago by fireattack (previous) (next) (diff)
Note: See TracTickets for help on using tickets.