Opened 8 years ago

Last modified 8 years ago

#5379 new defect

-ss option does not work for stream selection

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

Description

I am using 3.0 with

ffmpeg -ss xx -i in.mkv -c copy out.mp4

in.mkv has video, mp2 stereo and AC3 audio. AC3 is 2.0 stereo at position 0 and 5.1 surround at position xx. out.mp4 contains mp2 audio, while documentation states that no decode happens until position xx and thus AC3 audio should be selected. Easily confirmed on any satellite TV stream.

Current workaround for desired behaviour:

ffmpeg -ss xx -i in.mkv -map 0 -c copy -f matroska pipe:1 | ffmpeg -i - -c copy out.mp4

Attachments (1)

ac3.mkv (1.1 MB ) - added by gdittmer 8 years ago.
mkv with ac3 changing from 2ch to 5.1

Download all attachments as: .zip

Change History (3)

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

Component: ffmpegundetermined

Replying to gdittmer:

I am using 3.0 with

ffmpeg -ss xx -i in.mkv -c copy out.mp4

in.mkv has video, mp2 stereo and AC3 audio.

AC3 is 2.0 stereo at position 0 and 5.1 surround at position xx.

Are you sure this is a valid mkv file?

To make this a valid ticket, please test current FFmpeg git head and provide the command line that allows to reproduce thd issue together with the complete, uncut console output.

Last edited 8 years ago by Carl Eugen Hoyos (previous) (diff)

by gdittmer, 8 years ago

Attachment: ac3.mkv added

mkv with ac3 changing from 2ch to 5.1

comment:2 by gdittmer, 8 years ago

This is a design flaw. ffmpeg with -ss works as analyse, seek, process. It should work as seek, analyse, process.

The two following commands when run on the attached video should select the same streams, but they do not.

a) ffmpeg -ss 3 -i ac3.mkv -map 0 -c copy -f matroska pipe:1 | ffmpeg -i - -c copy -y -f matroska /dev/null

b) ffmpeg -ss 3 -i ac3.mkv -c copy -f matroska -y /dev/null

Output of a) ffmpeg -ss 3 -i ac3.mkv -map 0 -c copy -f matroska pipe:1 | ffmpeg -i - -c copy -y -f matroska /dev/null

ffmpeg version 3.0 Copyright (c) 2000-2016 the FFmpeg developers

built with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --enable-libvidstab --enable-libx265 --disable-doc --arch=x86_64 --enable-runtime-cpudetect
libavutil 55. 17.103 / 55. 17.103
libavcodec 57. 24.102 / 57. 24.102
libavformat 57. 25.100 / 57. 25.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 31.100 / 6. 31.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100

ffmpeg version 3.0 Copyright (c) 2000-2016 the FFmpeg developers

built with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --enable-libvidstab --enable-libx265 --disable-doc --arch=x86_64 --enable-runtime-cpudetect
libavutil 55. 17.103 / 55. 17.103
libavcodec 57. 24.102 / 57. 24.102
libavformat 57. 25.100 / 57. 25.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 31.100 / 6. 31.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 'ac3.mkv':

Metadata:

title : Arbitrage - Der Preis der Macht
SUMMARY-ger : Spielfilm USA / Polen 2012 (Arbitrage)
DESCRIPTION : Der New Yorker Multimillionär und Hedgefond-Manager Robert Miller steht kurz davor, das Geschäft seines Lebens abzuschließen: den enorm profitablen Verkauf seiner Firma. In dieser wichtigen Situation verschuldet er eines Nachts einen Autounfall, bei de
DESCRIPTION-ger : Der New Yorker Multimillionär und Hedgefond-Manager Robert Miller steht kurz davor, das Geschäft seines Lebens abzuschließen: den enorm profitablen Verkauf seiner Firma. In dieser wichtigen Situation verschuldet er eines Nachts einen Autounfall, bei de
DATE_BROADCASTED: 2016-04-06 22:15:00
ORIGINAL_MEDIA_TYPE: TV
CONTENT_TYPE : Movie / Drama
TVCHANNEL : EinsPlus HD
SUMMARY : Spielfilm USA / Polen 2012 (Arbitrage)
ENCODER : Lavf57.25.100

Duration: 00:00:03.65, start: 0.000000, bitrate: 2583 kb/s

Chapter #0:0: start 2.189000, end 3.000000
Stream #0:0(eng): Video: h264 (High), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 1k tbn, 100 tbc (default)
Metadata:

ENCODER : Lavc57.24.102 libx264
DURATION : 00:00:03.619000000

Stream #0:1(ger): Audio: mp2, 48000 Hz, stereo, s16p, 192 kb/s (default)
Metadata:

DURATION : 00:00:03.635000000

Stream #0:2(ger): Audio: ac3, 48000 Hz, stereo, fltp, 448 kb/s (default)
Metadata:

DURATION : 00:00:03.648000000

Output #0, matroska, to 'pipe:1':

Metadata:

title : Arbitrage - Der Preis der Macht
SUMMARY-ger : Spielfilm USA / Polen 2012 (Arbitrage)
DESCRIPTION : Der New Yorker Multimillionär und Hedgefond-Manager Robert Miller steht kurz davor, das Geschäft seines Lebens abzuschließen: den enorm profitablen Verkauf seiner Firma. In dieser wichtigen Situation verschuldet er eines Nachts einen Autounfall, bei de
DESCRIPTION-ger : Der New Yorker Multimillionär und Hedgefond-Manager Robert Miller steht kurz davor, das Geschäft seines Lebens abzuschließen: den enorm profitablen Verkauf seiner Firma. In dieser wichtigen Situation verschuldet er eines Nachts einen Autounfall, bei de
DATE_BROADCASTED: 2016-04-06 22:15:00
ORIGINAL_MEDIA_TYPE: TV
CONTENT_TYPE : Movie / Drama
TVCHANNEL : EinsPlus HD
SUMMARY : Spielfilm USA / Polen 2012 (Arbitrage)
encoder : Lavf57.25.100
Chapter #0:0: start 0.000000, end 0.000000
Stream #0:0(eng): Video: h264 (H264 / 0x34363248), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 50 fps, 50 tbr, 1k tbn, 1k tbc (default)
Metadata:

ENCODER : Lavc57.24.102 libx264
DURATION : 00:00:03.619000000

Stream #0:1(ger): Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, 192 kb/s (default)
Metadata:

DURATION : 00:00:03.635000000

Stream #0:2(ger): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, 448 kb/s (default)
Metadata:

DURATION : 00:00:03.648000000

Stream mapping:

Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Stream #0:2 -> #0:2 (copy)

Press [q] to stop, ? for help
[matroska @ 0x7fa4a1002600] failed to avoid negative pts -40 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
[matroska @ 0x7fa4a1002600] failed to avoid negative pts -35 in stream 2.
Try -avoid_negative_ts 1 as a possible workaround.
[matroska @ 0x7fa4a1002600] failed to avoid negative pts -16 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
[matroska @ 0x7fa4a1002600] failed to avoid negative pts -3 in stream 2.
Try -avoid_negative_ts 1 as a possible workaround.
Input #0, matroska,webm, from 'pipe:':

Metadata:

title : Arbitrage - Der Preis der Macht
SUMMARY : Spielfilm USA / Polen 2012 (Arbitrage)
SUMMARY-ger : Spielfilm USA / Polen 2012 (Arbitrage)
DESCRIPTION : Der New Yorker Multimillionär und Hedgefond-Manager Robert Miller steht kurz davor, das Geschäft seines Lebens abzuschließen: den enorm profitablen Verkauf seiner Firma. In dieser wichtigen Situation verschuldet er eines Nachts einen Autounfall, bei de
DESCRIPTION-ger : Der New Yorker Multimillionär und Hedgefond-Manager Robert Miller steht kurz davor, das Geschäft seines Lebens abzuschließen: den enorm profitablen Verkauf seiner Firma. In dieser wichtigen Situation verschuldet er eines Nachts einen Autounfall, bei de
DATE_BROADCASTED: 2016-04-06 22:15:00
ORIGINAL_MEDIA_TYPE: TV
CONTENT_TYPE : Movie / Drama
TVCHANNEL : EinsPlus HD
ENCODER : Lavf57.25.100

Duration: N/A, start: 0.040000, bitrate: N/A

Chapter #0:0: start 0.000000, end 0.000000
Stream #0:0(eng): Video: h264 (High), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 1k tbn, 100 tbc (default)
Metadata:

ENCODER : Lavc57.24.102 libx264

Stream #0:1(ger): Audio: mp2, 48000 Hz, stereo, s16p, 192 kb/s (default)
Stream #0:2(ger): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)

Output #0, matroska, to '/dev/null':

Metadata:

title : Arbitrage - Der Preis der Macht
SUMMARY : Spielfilm USA / Polen 2012 (Arbitrage)
SUMMARY-ger : Spielfilm USA / Polen 2012 (Arbitrage)
DESCRIPTION : Der New Yorker Multimillionär und Hedgefond-Manager Robert Miller steht kurz davor, das Geschäft seines Lebens abzuschließen: den enorm profitablen Verkauf seiner Firma. In dieser wichtigen Situation verschuldet er eines Nachts einen Autounfall, bei de
DESCRIPTION-ger : Der New Yorker Multimillionär und Hedgefond-Manager Robert Miller steht kurz davor, das Geschäft seines Lebens abzuschließen: den enorm profitablen Verkauf seiner Firma. In dieser wichtigen Situation verschuldet er eines Nachts einen Autounfall, bei de
DATE_BROADCASTED: 2016-04-06 22:15:00
ORIGINAL_MEDIA_TYPE: TV
CONTENT_TYPE : Movie / Drama
TVCHANNEL : EinsPlus HD
encoder : Lavf57.25.100
Chapter #0:0: start 0.040000, end 0.040000
Stream #0:0(eng): Video: h264 (H264 / 0x34363248), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 50 fps, 50 tbr, 1k tbn, 1k tbc (default)
Metadata:

ENCODER : Lavc57.24.102 libx264

Stream #0:1(ger): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), 448 kb/s (default)

Stream mapping:

Stream #0:0 -> #0:0 (copy)
Stream #0:2 -> #0:1 (copy)

frame= 56 fps=0.0 q=-1.0 Lsize= 457kB time=00:00:00.64 bitrate=5781.9kbits/s speed=43.1x
video:361kB audio:92kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.858408%
frame= 56 fps=0.0 q=-1.0 Lsize= 429kB time=00:00:01.18 bitrate=2956.1kbits/s speed= 379x
video:361kB audio:65kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.740386%

Output of b) ffmpeg -ss 3 -i ac3.mkv -c copy -f matroska -y /dev/null

ffmpeg version 3.0 Copyright (c) 2000-2016 the FFmpeg developers

built with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --enable-libvidstab --enable-libx265 --disable-doc --arch=x86_64 --enable-runtime-cpudetect
libavutil 55. 17.103 / 55. 17.103
libavcodec 57. 24.102 / 57. 24.102
libavformat 57. 25.100 / 57. 25.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 31.100 / 6. 31.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 'ac3.mkv':

Metadata:

title : Arbitrage - Der Preis der Macht
SUMMARY-ger : Spielfilm USA / Polen 2012 (Arbitrage)
DESCRIPTION : Der New Yorker Multimillionär und Hedgefond-Manager Robert Miller steht kurz davor, das Geschäft seines Lebens abzuschließen: den enorm profitablen Verkauf seiner Firma. In dieser wichtigen Situation verschuldet er eines Nachts einen Autounfall, bei de
DESCRIPTION-ger : Der New Yorker Multimillionär und Hedgefond-Manager Robert Miller steht kurz davor, das Geschäft seines Lebens abzuschließen: den enorm profitablen Verkauf seiner Firma. In dieser wichtigen Situation verschuldet er eines Nachts einen Autounfall, bei de
DATE_BROADCASTED: 2016-04-06 22:15:00
ORIGINAL_MEDIA_TYPE: TV
CONTENT_TYPE : Movie / Drama
TVCHANNEL : EinsPlus HD
SUMMARY : Spielfilm USA / Polen 2012 (Arbitrage)
ENCODER : Lavf57.25.100

Duration: 00:00:03.65, start: 0.000000, bitrate: 2583 kb/s

Chapter #0:0: start 2.189000, end 3.000000
Stream #0:0(eng): Video: h264 (High), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 1k tbn, 100 tbc (default)
Metadata:

ENCODER : Lavc57.24.102 libx264
DURATION : 00:00:03.619000000

Stream #0:1(ger): Audio: mp2, 48000 Hz, stereo, s16p, 192 kb/s (default)
Metadata:

DURATION : 00:00:03.635000000

Stream #0:2(ger): Audio: ac3, 48000 Hz, stereo, fltp, 448 kb/s (default)
Metadata:

DURATION : 00:00:03.648000000

Output #0, matroska, to '/dev/null':

Metadata:

title : Arbitrage - Der Preis der Macht
SUMMARY-ger : Spielfilm USA / Polen 2012 (Arbitrage)
DESCRIPTION : Der New Yorker Multimillionär und Hedgefond-Manager Robert Miller steht kurz davor, das Geschäft seines Lebens abzuschließen: den enorm profitablen Verkauf seiner Firma. In dieser wichtigen Situation verschuldet er eines Nachts einen Autounfall, bei de
DESCRIPTION-ger : Der New Yorker Multimillionär und Hedgefond-Manager Robert Miller steht kurz davor, das Geschäft seines Lebens abzuschließen: den enorm profitablen Verkauf seiner Firma. In dieser wichtigen Situation verschuldet er eines Nachts einen Autounfall, bei de
DATE_BROADCASTED: 2016-04-06 22:15:00
ORIGINAL_MEDIA_TYPE: TV
CONTENT_TYPE : Movie / Drama
TVCHANNEL : EinsPlus HD
SUMMARY : Spielfilm USA / Polen 2012 (Arbitrage)
encoder : Lavf57.25.100
Chapter #0:0: start 0.000000, end 0.000000
Stream #0:0(eng): Video: h264 (H264 / 0x34363248), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 50 fps, 50 tbr, 1k tbn, 1k tbc (default)
Metadata:

ENCODER : Lavc57.24.102 libx264
DURATION : 00:00:03.619000000

Stream #0:1(ger): Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, 192 kb/s (default)
Metadata:

DURATION : 00:00:03.635000000

Stream mapping:

Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)

Press [q] to stop, ? for help
[matroska @ 0x7fc38a013a00] failed to avoid negative pts -40 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
[matroska @ 0x7fc38a013a00] failed to avoid negative pts -16 in stream 1.
Try -avoid_negative_ts 1 as a possible workaround.
frame= 56 fps=0.0 q=-1.0 Lsize= 392kB time=00:00:00.63 bitrate=5057.5kbits/s speed= 295x
video:361kB audio:28kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.852921%

Note: See TracTickets for help on using tickets.