Opened 5 years ago

Closed 5 years ago

#7713 closed defect (invalid)

-to option is ignored

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

Description

How to reproduce:

E:\ffmpeg.exe -loglevel debug -ss 400 -i E:\Test\tearsofsteel_x265_2pass_3000.mkv -to 490 -c copy -avoid_negative_ts 1 E:\1.mkv
File is valid x265 encoded full Tears of Steel movie ()
ffmpeg version N-93069-g6dc06e979c
built with gcc 8.2.1 (GCC) 20181201 Windows x64

Output:
ffmpeg.exe -loglevel debug -ss 400 -i E:\Test\tearsofsteel_x265_2pass_3000.mkv -to 490 -c copy -avoid_negative_ts 1 E:\1.mkv
ffmpeg version N-93069-g6dc06e979c Copyright (c) 2000-2019 the FFmpeg developers

built with gcc 8.2.1 (GCC) 20181201
configuration: --disable-static --enable-shared --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-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 26.100 / 56. 26.100
libavcodec 58. 46.100 / 58. 46.100
libavformat 58. 26.100 / 58. 26.100
libavdevice 58. 6.101 / 58. 6.101
libavfilter 7. 48.100 / 7. 48.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100

Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-ss' ... matched as option 'ss' (set the start time offset) with argument '400'.
Reading option '-i' ... matched as input url with argument 'E:\Test\tearsofsteel_x265_2pass_3000.mkv'.
Reading option '-to' ... matched as option 'to' (record or transcode stop time) with argument '490'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-avoid_negative_ts' ... matched as AVOption 'avoid_negative_ts' with argument '1'.
Reading option 'E:\1.mkv' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url E:\Test\tearsofsteel_x265_2pass_3000.mkv.
Applying option ss (set the start time offset) with argument 400.
Successfully parsed a group of options.
Opening an input file: E:\Test\tearsofsteel_x265_2pass_3000.mkv.
[NULL @ 000001cc6d902600] Opening 'E:\Test\tearsofsteel_x265_2pass_3000.mkv' for reading
[file @ 000001cc6d903640] Setting default whitelist 'file,crypto'
[matroska,webm @ 000001cc6d902600] Format matroska,webm probed with size=2048 and score=100
st:0 removing common factor 1000000 from timebase
[matroska,webm @ 000001cc6d902600] Before avformat_find_stream_info() pos: 7550 bytes read:33165 seeks:2 nb_streams:1
[hevc @ 000001cc6d904e00] nal_unit_type: 32(VPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 000001cc6d904e00] Decoding VPS
[hevc @ 000001cc6d904e00] Main profile bitstream
[hevc @ 000001cc6d904e00] nal_unit_type: 33(SPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 000001cc6d904e00] Decoding SPS
[hevc @ 000001cc6d904e00] Main profile bitstream
[hevc @ 000001cc6d904e00] Decoding VUI
[hevc @ 000001cc6d904e00] nal_unit_type: 34(PPS), nuh_layer_id: 0, temporal_id: 0
[hevc @ 000001cc6d904e00] Decoding PPS
[hevc @ 000001cc6d904e00] nal_unit_type: 39(SEI_PREFIX), nuh_layer_id: 0, temporal_id: 0
[hevc @ 000001cc6d904e00] Decoding SEI
[hevc @ 000001cc6d904e00] Skipped PREFIX SEI 5
[matroska,webm @ 000001cc6d902600] All info found
[matroska,webm @ 000001cc6d902600] After avformat_find_stream_info() pos: 54828 bytes read:98701 seeks:2 frames:3
Input #0, matroska,webm, from 'E:\Test\tearsofsteel_x265_2pass_3000.mkv':

Metadata:

encoder : libebml v1.3.6 + libmatroska v1.4.9
creation_time : 2019-02-03T20:48:57.000000Z

Duration: 00:12:14.17, start: 0.000000, bitrate: 3001 kb/s

Stream #0:0, 3, 1/1000: Video: hevc (Main), 1 reference frame, yuv420p(tv), 2580x1080 (2584x1080), 0/1, SAR 1:1 DAR 43:18, 24 fps, 24 tbr, 1k tbn, 24 tbc (default)
Metadata:

BPS-eng : 3000220
DURATION-eng : 00:12:14.167000000
NUMBER_OF_FRAMES-eng: 17620
NUMBER_OF_BYTES-eng: 275332841
_STATISTICS_WRITING_APP-eng: mkvmerge v30.1.0 ('Forever And More') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng: 2019-02-03 20:48:57
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES

Successfully opened the file.
Parsing a group of options: output url E:\1.mkv.
Applying option to (record or transcode stop time) with argument 490.
Applying option c (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: E:\1.mkv.
After MANY [matroska @ 000001cc6d909b40] Writing block at offset 530291, size 231, pts 338708, dts 338708, duration 41, keyframe 0

No more output streams to write to, finishing.
[matroska @ 000001cc6d909b40] end duration = 338832
[matroska @ 000001cc6d909b40] stream 0 end duration = 338832
frame= 8134 fps=4004 q=-1.0 Lsize= 144911kB time=00:05:34.04 bitrate=3553.8kbits/s speed= 164x
video:144846kB audio:0kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: 0.044833%
Input file #0 (E:\Test\tearsofsteel_x265_2pass_3000.mkv):

Input stream #0:0 (video): 8134 packets read (148322722 bytes);
Total: 8134 packets (148322722 bytes) demuxed

Output file #0 (B:\1.mkv):

Output stream #0:0 (video): 8134 packets muxed (148322722 bytes);
Total: 8134 packets (148322722 bytes) muxed

0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 000001cc6d93ea80] Statistics: 190 seeks, 713 writeouts
[AVIOContext @ 000001cc6d90b8c0] Statistics: 148489635 bytes read, 5 seeks

File is valid x265 encoded full Tears of Steel movie (00:12:14)
As https://www.ffmpeg.org/ffmpeg-all.html#toc-Main-options said it should cut 90 seconds, but option is ignored and stops at the file's end. What is not ignored and works as it should is a replacement by -t 90, that cuts 90 seconds (95 in reality due to copy option).

Change History (1)

comment:1 by Gyan, 5 years ago

Priority: normalminor
Resolution: invalid
Status: newclosed

Both -ss and -to should be placed together, since these options operate at different stages depending on their placement. So, either -ss 400 -to 490 -i ... or -i ... -ss 400 -to 490

Note: See TracTickets for help on using tickets.