Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#2054 closed enhancement (duplicate)

Specifying -ss before -i breaks the conversions

Reported by: ramitbhalla Owned by:
Priority: wish Component: undetermined
Version: git-master Keywords: mpegts mpeg2video av_interleaved_write_frame
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: This is related to ticket #2028, a regression issue, originally specifying -ss after -i caused the audio to break, that was fixed however now specifying -ss before -i is causing the conversion to fail.

The sample file is uploaded at:
http://www.mediafire.com/?hj8e5kwfd9jq93c

See below:

SPECIFYING -ss AFTER -i WORKS FINE

ffmpeg -y -i Test6.ts -ss 30 -t 1727 -map 0:a -map 0:v -vcodec copy -acodec copy test-temp
.ts
ffmpeg version N-48065-g6375318 Copyright (c) 2000-2012 the FFmpeg developers
  built on Dec 21 2012 09:06:30 with gcc 4.7.2 (GCC)
  configuration: --enable-static --arch=x86 --target-os=mingw32 --cross-prefix=/home/rdp/dev/ffmpeg-windows-build-helper
s/sandbox/mingw-w64-i686/bin/i686-w64-mingw32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth -
-enable-libxvid --enable-libmp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheo
ra --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-fontconfig --ena
ble-libass --enable-libutvideo --enable-libopus --disable-w32threads --enable-frei0r --enable-filter=frei0r --enable-lib
vo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable-libopencore-amrnb --enable-libopenc
ore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libbluray --enable-libvpx --enable-runtime-cpudetect

  libavutil      52. 12.100 / 52. 12.100
  libavcodec     54. 81.100 / 54. 81.100
  libavformat    54. 49.102 / 54. 49.102
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 29.100 /  3. 29.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mpeg, from 'Test6.ts':
  Duration: 00:00:33.95, start: 0.200000, bitrate: 14824 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn,
59.94 tbc
    Stream #0:1[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 96 kb/s (visual impaired)
Output #0, mpegts, to 'test-temp.ts':
  Metadata:
    encoder         : Lavf54.49.102
    Stream #0:0: Audio: ac3, 48000 Hz, stereo, 96 kb/s (visual impaired)
    Stream #0:1: Video: mpeg2video, yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 90k tbn, 29.97 tbc
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=   58 fps=0.0 q=-1.0 Lsize=    4127kB time=00:00:04.11 bitrate=8221.9kbits/s
video:3773kB audio:48kB subtitle:0 global headers:0kB muxing overhead 8.002266%

SPECIFYING -ss BEFORE -i BREAKS

ffmpeg -y -ss 30 -i Test6.ts -t 1727 -map 0:a -map 0:v -vcodec copy -acodec copy test-temp
.ts
ffmpeg version N-48065-g6375318 Copyright (c) 2000-2012 the FFmpeg developers
  built on Dec 21 2012 09:06:30 with gcc 4.7.2 (GCC)
  configuration: --enable-static --arch=x86 --target-os=mingw32 --cross-prefix=/home/rdp/dev/ffmpeg-windows-build-helper
s/sandbox/mingw-w64-i686/bin/i686-w64-mingw32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth -
-enable-libxvid --enable-libmp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheo
ra --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-fontconfig --ena
ble-libass --enable-libutvideo --enable-libopus --disable-w32threads --enable-frei0r --enable-filter=frei0r --enable-lib
vo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable-libopencore-amrnb --enable-libopenc
ore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libbluray --enable-libvpx --enable-runtime-cpudetect

  libavutil      52. 12.100 / 52. 12.100
  libavcodec     54. 81.100 / 54. 81.100
  libavformat    54. 49.102 / 54. 49.102
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 29.100 /  3. 29.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mpeg, from 'Test6.ts':
  Duration: 00:00:33.95, start: 0.200000, bitrate: 14824 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn,
59.94 tbc
    Stream #0:1[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 96 kb/s (visual impaired)
Output #0, mpegts, to 'test-temp.ts':
  Metadata:
    encoder         : Lavf54.49.102
    Stream #0:0: Audio: ac3, 48000 Hz, stereo, 96 kb/s (visual impaired)
    Stream #0:1: Video: mpeg2video, yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 90k tbn, 29.97 tbc
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mpegts @ 02c57dc0] first pts value must set
av_interleaved_write_frame(): Invalid data found when processing input

Change History (5)

comment:1 Changed 6 years ago by cehoyos

  • Component changed from FFmpeg to undetermined
  • Keywords mpegts mpeg2video av_interleaved_write_frame added
  • Priority changed from important to wish
  • Resolution set to duplicate
  • Status changed from new to closed
  • Type changed from defect to enhancement

Please understand that seeking before decoding and decoding / demuxing until a specific point in time ("putting -ss before or after -i") are completely different things that cannot be compared or used for comparison in a bug report. It is for example not a valid report to say "-ss before -i is less exact than -ss after -i", and the title for this ticket is also definitely invalid.

You may report "some seeking values lead to 'first pts value must set' with -codec copy", but imo, this is just a duplicate of ticket #1979.

comment:2 follow-up: Changed 6 years ago by ramitbhalla

I see your point. The way I see it from a users point of view, there are 2 ways to seek:

  1. Fast/rough seek - before -i
  2. Slow/accurate seek - after -i

one works, the other broke :) - hence the title

Also, I've noticed you've marked ticket #1979 as a "wish". Given the current situation that seeking leads to a conversion failure, isn't it a critical failure rather than an enhancement wish?

comment:3 in reply to: ↑ 2 Changed 6 years ago by cehoyos

Replying to ramitbhalla:

Also, I've noticed you've marked ticket #1979 as a "wish". Given the current situation that seeking leads to a conversion failure, isn't it a critical failure rather than an enhancement wish?

For many values, seeking works fine.
For some values, seeking leads to an error message that clearly indicates a missing parameter. This parameter was always needed for some stream copying operations, adding it automatically is an enhancement request.

comment:4 follow-up: Changed 6 years ago by ramitbhalla

If you don't mind me asking, since I expect enhancement are usually low priority, it will take time to fix but I need to get my scripts working.

What is the downside to add -fflags +genpts by default to all my scripts (for all videos)?

comment:5 in reply to: ↑ 4 Changed 6 years ago by cehoyos

Replying to ramitbhalla:

What is the downside to add -fflags +genpts by default to all my scripts (for all videos)?

I don't know.

Note: See TracTickets for help on using tickets.