Opened 8 years ago

Last modified 8 years ago

#5212 open defect

Can't seek while using -re and -ss at the same time

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

Description

Summary of the bug:
If i use -re while using -ss 10, the video will be delayed by 10 seconds, instead of skipping 10 seconds into the video, which is normal behavior while not using -re

How to reproduce:

ffmpeg -re -ss 10 -i test.mkv -c:v copy -c:a copy new.mkv

Output:

ffmpeg version N-78257-gdd57b31 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=/opt/ffmpeg --enable-libx264 --enable-libssh --enable-libfdk-aac --enable-libmp3lame --enable-libxvid --enable-libvpx --enable-openssl --enable-gpl --enable-nonfree
  libavutil      55. 17.100 / 55. 17.100
  libavcodec     57. 24.101 / 57. 24.101
  libavformat    57. 24.100 / 57. 24.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 28.100 /  6. 28.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, matroska,webm, from 'test.mkv':
  Metadata:
    ENCODER         : Lavf57.24.100
  Duration: 00:01:30.60, start: 0.000000, bitrate: 11347 kb/s
    Chapter #0:0: start 0.000000, end 5.463000
    Chapter #0:1: start 5.463000, end 93.508000
    Stream #0:0: Video: h264 (High), yuv420p, 1920x800, SAR 1:1 DAR 12:5, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Metadata:
      DURATION        : 00:01:30.590000000
    Stream #0:1: Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s (default)
    Metadata:
      DURATION        : 00:01:30.600000000
Output #0, matroska, to 'new.mkv':
  Metadata:
    encoder         : Lavf57.24.100
    Chapter #0:0: start 0.000000, end 83.508000
    Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 1920x800 [SAR 1:1 DAR 12:5], q=2-31, 23.98 fps, 23.98 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      DURATION        : 00:01:30.590000000
    Stream #0:1: Audio: dts (DTS) ([1] [0][0] / 0x2001), 48000 Hz, 5.1(side), 1536 kb/s (default)
    Metadata:
      DURATION        : 00:01:30.600000000
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[matroska @ 0x3122200] failed to avoid negative pts -75 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
[matroska @ 0x3122200] failed to avoid negative pts -63 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
[matroska @ 0x3122200] failed to avoid negative pts -53 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
[matroska @ 0x3122200] failed to avoid negative pts -42 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
[matroska @ 0x3122200] failed to avoid negative pts -31 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
[matroska @ 0x3122200] failed to avoid negative pts -21 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
[matroska @ 0x3122200] failed to avoid negative pts -10 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
frame= 1958 fps= 24 q=-1.0 Lsize=  113108kB time=00:01:20.59 bitrate=11497.4kbits/s speed=   1x    
video:97980kB audio:15059kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.061519%

Change History (11)

comment:1 by groove, 8 years ago

Component: undeterminedffmpeg
Priority: normalimportant

comment:2 by Carl Eugen Hoyos, 8 years ago

Is this issue a regression?

in reply to:  2 comment:3 by groove, 8 years ago

No, i dont think so, same behavior in ffmpeg version 2.8.5

in reply to:  description ; comment:4 by Carl Eugen Hoyos, 8 years ago

Priority: importantnormal

Replying to groove:

If i use -re while using -ss 10, the video will be delayed by 10 seconds, instead of skipping 10 seconds into the video, which is normal behavior while not using -re

How did you test this?

in reply to:  4 comment:5 by groove, 8 years ago

If you write the command in my ticket, you will see ffmpeg is going through the first 10 seconds at normal speed, instead of just skipping the first 10 seconds fast

comment:6 by Carl Eugen Hoyos, 8 years ago

Resolution: worksforme
Status: newclosed

I cannot reproduce this:

$ time ./ffmpeg -ss 10 -i test.mkv -c:v copy -c:a copy new.mkv
ffmpeg version N-78269-gc1b23e1 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --enable-libmp3lame
  libavutil      55. 17.100 / 55. 17.100
  libavcodec     57. 24.101 / 57. 24.101
  libavformat    57. 24.100 / 57. 24.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 28.100 /  6. 28.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, matroska,webm, from 'test.mkv':
  Metadata:
    ENCODER         : Lavf55.48.100
  Duration: 00:00:10.17, start: 0.067000, bitrate: 1875 kb/s
    Stream #0:0: Video: h264 (High), yuvj420p(pc), 320x240, SAR 1:1 DAR 4:3, 30 fps, 30 tbr, 1k tbn, 60 tbc (default)
    Metadata:
      ENCODER         : Lavc55.69.100 libx264
    Stream #0:1: Audio: dts (DTS), 44100 Hz, mono, fltp, 1536 kb/s (default)
    Metadata:
      ENCODER         : Lavc55.69.100 dca
Output #0, matroska, to 'new.mkv':
  Metadata:
    encoder         : Lavf57.24.100
    Stream #0:0: Video: h264 (H264 / 0x34363248), yuvj420p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 30 fps, 30 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      ENCODER         : Lavc55.69.100 libx264
    Stream #0:1: Audio: dts (DTS) ([1] [0][0] / 0x2001), 44100 Hz, mono, 1536 kb/s (default)
    Metadata:
      ENCODER         : Lavc55.69.100 dca
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[matroska @ 0x2c2cea0] failed to avoid negative pts -66 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
[matroska @ 0x2c2cea0] failed to avoid negative pts -54 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
[matroska @ 0x2c2cea0] failed to avoid negative pts -42 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
[matroska @ 0x2c2cea0] failed to avoid negative pts -31 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
[matroska @ 0x2c2cea0] failed to avoid negative pts -19 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
[matroska @ 0x2c2cea0] failed to avoid negative pts -7 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
frame=   13 fps=0.0 q=-1.0 Lsize=     113kB time=00:00:00.08 bitrate=10392.5kbits/s speed= 111x
video:18kB audio:94kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.164622%

real    0m0.007s
user    0m0.003s
sys     0m0.003s
$ time ./ffmpeg -re -ss 10 -i test.mkv -c:v copy -c:a copy new.mkv
ffmpeg version N-78269-gc1b23e1 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --enable-libmp3lame
  libavutil      55. 17.100 / 55. 17.100
  libavcodec     57. 24.101 / 57. 24.101
  libavformat    57. 24.100 / 57. 24.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 28.100 /  6. 28.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, matroska,webm, from 'test.mkv':
  Metadata:
    ENCODER         : Lavf55.48.100
  Duration: 00:00:10.17, start: 0.067000, bitrate: 1875 kb/s
    Stream #0:0: Video: h264 (High), yuvj420p(pc), 320x240, SAR 1:1 DAR 4:3, 30 fps, 30 tbr, 1k tbn, 60 tbc (default)
    Metadata:
      ENCODER         : Lavc55.69.100 libx264
    Stream #0:1: Audio: dts (DTS), 44100 Hz, mono, fltp, 1536 kb/s (default)
    Metadata:
      ENCODER         : Lavc55.69.100 dca
Output #0, matroska, to 'new.mkv':
  Metadata:
    encoder         : Lavf57.24.100
    Stream #0:0: Video: h264 (H264 / 0x34363248), yuvj420p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 30 fps, 30 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      ENCODER         : Lavc55.69.100 libx264
    Stream #0:1: Audio: dts (DTS) ([1] [0][0] / 0x2001), 44100 Hz, mono, 1536 kb/s (default)
    Metadata:
      ENCODER         : Lavc55.69.100 dca
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[matroska @ 0x3af6ec0] failed to avoid negative pts -66 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
[matroska @ 0x3af6ec0] failed to avoid negative pts -54 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
[matroska @ 0x3af6ec0] failed to avoid negative pts -42 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
[matroska @ 0x3af6ec0] failed to avoid negative pts -31 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
[matroska @ 0x3af6ec0] failed to avoid negative pts -19 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
[matroska @ 0x3af6ec0] failed to avoid negative pts -7 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
frame=   13 fps=0.0 q=-1.0 Lsize=     113kB time=00:00:00.08 bitrate=10392.5kbits/s speed=0.97x
video:18kB audio:94kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.164622%

real    0m0.099s
user    0m0.003s
sys     0m0.005s

Seeking over the first ten seconds takes virtually no time both with and without -re.

in reply to:  6 comment:7 by groove, 8 years ago

Sorry about that, this only occurs when setting the -copyts argument.

ffmpeg -re -ss 10 -i test.mkv -c:v copy -c:a copy -copyts new.mkv

comment:8 by groove, 8 years ago

Resolution: worksforme
Status: closedreopened

comment:9 by groove, 8 years ago

Status: reopenedopen

comment:10 by Umair, 8 years ago

I'm really not able to reproduce this.
The output is same with or without -re.
Although, the output video is being skipped only around 7 seconds instead of the exact 10 seconds.

in reply to:  10 comment:11 by groove, 8 years ago

Have you tried with the -copyts argument also?

$ time ffmpeg -re -ss 10 -i test.mkv -c:v copy -c:a copy -copyts new.mkv
ffmpeg version N-78257-gdd57b31 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=/opt/ffmpeg --enable-libx264 --enable-libvorbis --enable-libssh --enable-libfdk-aac --enable-libmp3lame --enable-libxvid --enable-libvpx --enable-openssl --enable-gpl --enable-nonfree
  libavutil      55. 17.100 / 55. 17.100
  libavcodec     57. 24.101 / 57. 24.101
  libavformat    57. 24.100 / 57. 24.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 28.100 /  6. 28.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, matroska,webm, from 'test.mkv':
  Metadata:
    ENCODER         : Lavf57.24.100
  Duration: 00:00:15.10, start: 0.000000, bitrate: 11552 kb/s
    Chapter #0:0: start 0.000000, end 5.463000
    Chapter #0:1: start 5.463000, end 15.000000
    Stream #0:0: Video: h264 (High), yuv420p, 1920x800, SAR 1:1 DAR 12:5, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Metadata:
      DURATION        : 00:00:15.098000000
    Stream #0:1: Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s (default)
    Metadata:
      DURATION        : 00:00:15.006000000
Output #0, matroska, to 'new.mkv':
  Metadata:
    encoder         : Lavf57.24.100
    Chapter #0:0: start 0.000000, end 5.463000
    Chapter #0:1: start 5.463000, end 15.000000
    Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 1920x800 [SAR 1:1 DAR 12:5], q=2-31, 23.98 fps, 23.98 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      DURATION        : 00:00:15.098000000
    Stream #0:1: Audio: dts (DTS) ([1] [0][0] / 0x2001), 48000 Hz, 5.1(side), 1536 kb/s (default)
    Metadata:
      DURATION        : 00:00:15.006000000
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  148 fps=9.9 q=-1.0 Lsize=    8895kB time=00:00:14.99 bitrate=4859.1kbits/s speed=   1x    
video:7755kB audio:1134kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.069336%

real	0m15.053s
user	0m0.072s
sys	0m0.036s
Note: See TracTickets for help on using tickets.