Opened 7 months ago

Closed 2 months ago

#9141 closed defect (fixed)

Input option -t/-to totally ignored when stream copying MPEG-TS recorded from TV

Reported by: fireattack Owned by: uptowncat
Priority: minor Component: ffmpeg
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

Summary of the bug:

No bug if put -t after -i (-ss is still before -i), stream copying or transcoding:

Good:

ffmpeg -ss 10:00 -i t.ts -t 1:00 -c copy ss_i_t_copy.ts
ffmpeg -ss 10:00 -i t.ts -t 1:00 -preset ultrafast ss_i_t_encode.ts 

No bug when -t is before -i, but transcoding:

Good:

ffmpeg -ss 10:00 -t 1:00 -i t.ts -preset ultrafast ss_t_i_encode.ts

However, -t is totally ignored when when -t is before -i and stream copying:

Bad:

ffmpeg -ss 10:00 -t 1:00 -i t.ts -c copy ss_t_i_copy.ts

The above will just trim my video from 10:00 to the very end, instead of 1min.

How to reproduce:

>ffmpeg -ss 10:00 -t 1:00 -i t.ts -c copy ss_t_i_copy.ts -y


ffmpeg version 2021-01-24-git-1775688292-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10.2.0 (Rev6, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      56. 63.101 / 56. 63.101
  libavcodec     58.117.101 / 58.117.101
  libavformat    58. 65.101 / 58. 65.101
  libavdevice    58. 11.103 / 58. 11.103
  libavfilter     7. 96.100 /  7. 96.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
[mpeg2video @ 000000000047dd00] Invalid frame dimensions 0x0.
    Last message repeated 13 times
[mpegts @ 0000000000476e00] start time for stream 4 is not set in estimate_timings_from_pts
[mpegts @ 0000000000476e00] PES packet size mismatch
[mpegts @ 0000000000476e00] Packet corrupt (stream = 1, dts = 3729827640).
[mpegts @ 0000000000476e00] stream 2 : no PTS found at end of file, duration not set
[mpegts @ 0000000000476e00] Could not find codec parameters for stream 5 (Unknown: none ([13][0][0][0] / 0x000D)): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0000000000476e00] Could not find codec parameters for stream 6 (Unknown: none ([13][0][0][0] / 0x000D)): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0000000000476e00] Could not find codec parameters for stream 7 (Unknown: none ([13][0][0][0] / 0x000D)): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0000000000476e00] Could not find codec parameters for stream 8 (Unknown: none ([13][0][0][0] / 0x000D)): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0000000000476e00] Could not find codec parameters for stream 9 (Unknown: none ([13][0][0][0] / 0x000D)): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0000000000476e00] Could not find codec parameters for stream 10 (Unknown: none ([13][0][0][0] / 0x000D)): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0000000000476e00] Could not find codec parameters for stream 11 (Unknown: none ([13][0][0][0] / 0x000D)): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0000000000476e00] PES packet size mismatch
[mpegts @ 0000000000476e00] Packet corrupt (stream = 1, dts = 3729827640).
[mpegts @ 0000000000476e00] PES packet size mismatch
[mpegts @ 0000000000476e00] Packet corrupt (stream = 1, dts = 3729827640).
Input #0, mpegts, from 't.ts':
  Duration: 00:45:58.83, start: 38683.852000, bitrate: 14829 kb/s
  Program 1024 
    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
    Side data:
      cpb: bitrate max/min/avg: 20000000/0/0 buffer size: 9781248 vbv_delay: N/A
    Stream #0:1[0x110]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 297 kb/s
    Stream #0:3[0x130]: Subtitle: arib_caption (Profile A) ([6][0][0][0] / 0x0006)
    Stream #0:4[0x138]: Data: bin_data ([6][0][0][0] / 0x0006)
    Stream #0:5[0x140]: Unknown: none ([13][0][0][0] / 0x000D)
    Stream #0:6[0x160]: Unknown: none ([13][0][0][0] / 0x000D)
    Stream #0:7[0x161]: Unknown: none ([13][0][0][0] / 0x000D)
    Stream #0:8[0x162]: Unknown: none ([13][0][0][0] / 0x000D)
    Stream #0:9[0x170]: Unknown: none ([13][0][0][0] / 0x000D)
    Stream #0:10[0x171]: Unknown: none ([13][0][0][0] / 0x000D)
    Stream #0:11[0x172]: Unknown: none ([13][0][0][0] / 0x000D)
  No Program
    Stream #0:2[0x111]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 134 kb/s
Output #0, mpegts, to 'ss_t_i_copy.ts':
  Metadata:
    encoder         : Lavf58.65.101
    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
    Side data:
      cpb: bitrate max/min/avg: 20000000/0/0 buffer size: 9781248 vbv_delay: N/A
    Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 297 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 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame= 4755 fps=0.0 q=-1.0 size=  267520kB time=00:02:38.84 bitrate=13796.4kbits/s speed= 318x    
frame= 8871 fps=8871 q=-1.0 size=  498944kB time=00:04:56.18 bitrate=13800.0kbits/s speed= 296x    
frame=13609 fps=9070 q=-1.0 size=  765952kB time=00:07:34.27 bitrate=13812.5kbits/s speed= 303x    
frame=18648 fps=9322 q=-1.0 size= 1048832kB time=00:10:22.42 bitrate=13804.2kbits/s speed= 311x    
frame=22874 fps=9145 q=-1.0 size= 1286656kB time=00:12:43.41 bitrate=13806.7kbits/s speed= 305x    
frame=23213 fps=7612 q=-1.0 size= 1305856kB time=00:12:54.72 bitrate=13808.2kbits/s speed= 254x    
frame=23264 fps=6519 q=-1.0 size= 1308672kB time=00:12:56.43 bitrate=13807.6kbits/s speed= 218x    
frame=23315 fps=5408 q=-1.0 size= 1311488kB time=00:12:58.13 bitrate=13807.1kbits/s speed= 180x    
frame=23366 fps=4497 q=-1.0 size= 1314304kB time=00:12:59.83 bitrate=13806.5kbits/s speed= 150x    
frame=23583 fps=4140 q=-1.0 size= 1326848kB time=00:13:07.07 bitrate=13810.1kbits/s speed= 138x    
frame=25020 fps=4038 q=-1.0 size= 1407488kB time=00:13:55.02 bitrate=13808.2kbits/s speed= 135x    
frame=26220 fps=3914 q=-1.0 size= 1474048kB time=00:14:35.07 bitrate=13799.3kbits/s speed= 131x    
frame=26260 fps=3560 q=-1.0 size= 1476352kB time=00:14:36.39 bitrate=13800.0kbits/s speed= 119x    
frame=27246 fps=3459 q=-1.0 size= 1531648kB time=00:15:09.29 bitrate=13798.9kbits/s speed= 115x    
frame=28609 fps=3415 q=-1.0 size= 1608448kB time=00:15:54.79 bitrate=13800.3kbits/s speed= 114x    
frame=29306 fps=3300 q=-1.0 size= 1647616kB time=00:16:18.03 bitrate=13800.4kbits/s speed= 110x    
frame=29352 fps=3106 q=-1.0 size= 1650176kB time=00:16:19.56 bitrate=13800.2kbits/s speed= 104x    
frame=30297 fps=3044 q=-1.0 size= 1703168kB time=00:16:51.09 bitrate=13799.2kbits/s speed= 102x    
frame=31877 fps=3050 q=-1.0 size= 1792256kB time=00:17:43.81 bitrate=13801.4kbits/s speed= 102x    
frame=32504 fps=2868 q=-1.0 size= 1827584kB time=00:18:04.73 bitrate=13802.0kbits/s speed=95.7x    
frame=33003 fps=2789 q=-1.0 size= 1855744kB time=00:18:21.39 bitrate=13802.7kbits/s speed=93.1x    
frame=34589 fps=2805 q=-1.0 size= 1944576kB time=00:19:14.30 bitrate=13800.4kbits/s speed=93.6x    
frame=35562 fps=2757 q=-1.0 size= 1999360kB time=00:19:46.77 bitrate=13801.1kbits/s speed=  92x    
frame=35611 fps=2653 q=-1.0 size= 2002432kB time=00:19:48.43 bitrate=13802.9kbits/s speed=88.5x    
frame=36459 fps=2618 q=-1.0 size= 2050048kB time=00:20:16.70 bitrate=13802.9kbits/s speed=87.4x    
frame=38025 fps=2636 q=-1.0 size= 2137856kB time=00:21:08.97 bitrate=13801.2kbits/s speed=  88x    
frame=38714 fps=2561 q=-1.0 size= 2176512kB time=00:21:31.94 bitrate=13800.9kbits/s speed=85.5x    
frame=38763 fps=2477 q=-1.0 size= 2179584kB time=00:21:33.61 bitrate=13802.6kbits/s speed=82.7x    
frame=39907 fps=2471 q=-1.0 size= 2243584kB time=00:22:11.75 bitrate=13800.9kbits/s speed=82.5x    
frame=41382 fps=2483 q=-1.0 size= 2326528kB time=00:23:00.96 bitrate=13801.1kbits/s speed=82.9x    
frame=41405 fps=2344 q=-1.0 size= 2327808kB time=00:23:01.73 bitrate=13801.1kbits/s speed=78.2x    
frame=42929 fps=2364 q=-1.0 size= 2413824kB time=00:23:52.58 bitrate=13803.0kbits/s speed=78.9x    
frame=44371 fps=2377 q=-1.0 size= 2494976kB time=00:24:40.72 bitrate=13803.3kbits/s speed=79.3x    
frame=44396 fps=2301 q=-1.0 size= 2496256kB time=00:24:41.53 bitrate=13802.8kbits/s speed=76.8x    
frame=44447 fps=2245 q=-1.0 size= 2499328kB time=00:24:43.24 bitrate=13803.9kbits/s speed=74.9x    
frame=45967 fps=2264 q=-1.0 size= 2584576kB time=00:25:33.95 bitrate=13802.8kbits/s speed=75.6x    
frame=46979 fps=2256 q=-1.0 size= 2641664kB time=00:26:07.74 bitrate=13803.6kbits/s speed=75.3x    
frame=47030 fps=2200 q=-1.0 size= 2644480kB time=00:26:09.42 bitrate=13803.5kbits/s speed=73.4x    
frame=47279 fps=2161 q=-1.0 size= 2658560kB time=00:26:17.73 bitrate=13804.0kbits/s speed=72.1x    
frame=48769 fps=2180 q=-1.0 size= 2742272kB time=00:27:07.44 bitrate=13803.6kbits/s speed=72.7x    
frame=49562 fps=2165 q=-1.0 size= 2787072kB time=00:27:33.90 bitrate=13804.7kbits/s speed=72.3x    
frame=49620 fps=2121 q=-1.0 size= 2790144kB time=00:27:35.87 bitrate=13803.5kbits/s speed=70.8x    
frame=50011 fps=2093 q=-1.0 size= 2812160kB time=00:27:48.88 bitrate=13803.9kbits/s speed=69.8x    
frame=51477 fps=2110 q=-1.0 size= 2894592kB time=00:28:37.80 bitrate=13804.0kbits/s speed=70.4x    
frame=52233 fps=2098 q=-1.0 size= 2937344kB time=00:29:03.02 bitrate=13805.1kbits/s speed=  70x    
frame=52272 fps=2058 q=-1.0 size= 2939392kB time=00:29:04.33 bitrate=13804.4kbits/s speed=68.7x    
frame=52623 fps=2032 q=-1.0 size= 2959360kB time=00:29:16.05 bitrate=13805.4kbits/s speed=67.8x    
frame=53969 fps=2044 q=-1.0 size= 3034880kB time=00:30:00.95 bitrate=13804.8kbits/s speed=68.2x    
frame=54607 fps=2016 q=-1.0 size= 3070976kB time=00:30:22.24 bitrate=13805.8kbits/s speed=67.3x    
frame=54633 fps=1973 q=-1.0 size= 3072256kB time=00:30:23.10 bitrate=13804.9kbits/s speed=65.8x    
frame=56009 fps=1987 q=-1.0 size= 3149824kB time=00:31:09.02 bitrate=13805.8kbits/s speed=66.3x    
frame=57288 fps=1996 q=-1.0 size= 3221760kB time=00:31:51.72 bitrate=13805.7kbits/s speed=66.6x    
frame=57331 fps=1964 q=-1.0 size= 3224064kB time=00:31:53.13 bitrate=13805.4kbits/s speed=65.5x    
frame=57380 fps=1931 q=-1.0 size= 3226880kB time=00:31:54.76 bitrate=13805.6kbits/s speed=64.5x    
frame=58800 fps=1946 q=-1.0 size= 3306752kB time=00:32:42.14 bitrate=13805.7kbits/s speed=  65x    
frame=60000 fps=1954 q=-1.0 size= 3374336kB time=00:33:22.18 bitrate=13806.2kbits/s speed=65.2x    
frame=60047 fps=1921 q=-1.0 size= 3376896kB time=00:33:23.75 bitrate=13805.8kbits/s speed=64.1x    
frame=60197 fps=1896 q=-1.0 size= 3385344kB time=00:33:28.76 bitrate=13805.9kbits/s speed=63.3x    
frame=61616 fps=1910 q=-1.0 size= 3465216kB time=00:34:16.10 bitrate=13806.2kbits/s speed=63.7x    
frame=62702 fps=1912 q=-1.0 size= 3526656kB time=00:34:52.37 bitrate=13807.5kbits/s speed=63.8x    
frame=62758 fps=1883 q=-1.0 size= 3529472kB time=00:34:54.21 bitrate=13806.3kbits/s speed=62.8x    
frame=63006 fps=1862 q=-1.0 size= 3543552kB time=00:35:02.48 bitrate=13806.9kbits/s speed=62.1x    
frame=64522 fps=1879 q=-1.0 size= 3622656kB time=00:35:53.07 bitrate=13783.5kbits/s speed=62.7x    
[mpegts @ 0000000000476e00] PES packet size mismatch
[mpegts @ 0000000000476e00] Packet corrupt (stream = 1, dts = 3729827640).
frame=64692 fps=1882 q=-1.0 Lsize= 3631249kB time=00:35:58.74 bitrate=13779.9kbits/s speed=62.8x    
video:3468905kB audio:67399kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.684858%

Change History (4)

comment:1 by Carl Eugen Hoyos, 7 months ago

Component: undeterminedffmpeg
Priority: normalminor
Reproduced by developer: set
Summary: Input seeking -t/-to totally ignored when seeking MPEG-TS recorded from TV (stream copy only)Input option -t/-to totally ignored when stream copying MPEG-TS recorded from TV
Version: unspecifiedgit-master

Use the output option -t as a work-around.

comment:2 by uptowncat, 5 months ago

Analyzed by developer: set
Owner: set to uptowncat
Status: newopen

comment:4 by Balling, 2 months ago

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