[FFmpeg-user] Precedence matters: Non-monotonous DTS in output stream 0:0;

MrNice wxcvbn2006 at iol.ie
Sat Nov 21 13:46:42 CET 2015


Hello,

Precedence matters in the command line.
With the 2 commands, note that audio input is before video input

./ffmpeg -debug 1 -xerror -f pulse -ar 44100 -ac 2 -channel_layout
stereo -thread_queue_size 1024 -i
alsa_input.pci-0000_00_14.2.analog-stereo -f v4l2 -channel 1 -video_size
720x576 -pix_fmt yuyv422 -thread_queue_size 1024 -i /dev/video0 -c:a
pcm_s16le -channel_layout stereo -c:v ffv1 -level 3 -g 1 -aspect 4:3
-pix_fmt yuv422p -top 0 -vsync passthrough /Store3/Test/t_`date
+%Y%m%d_%H%M`.mkv

./ffmpeg -debug 1 -xerror -f pulse -ar 44100 -ac 2 -channel_layout
stereo -thread_queue_size 1024 -i
alsa_input.pci-0000_00_14.2.analog-stereo -f v4l2 -channel 1 -video_size
720x576 -pix_fmt yuyv422 -thread_queue_size 1024 -i /dev/video0 -c:v
ffv1 -level 3 -g 1 -aspect 4:3 -pix_fmt yuv422p -top 0 -vsync
passthrough -c:a pcm_s16le -channel_layout stereo /Store3/Test/t_`date
+%Y%m%d_%H%M`.mkv

I don't have any error


With the 2 commands, note that audio input is after video input

./ffmpeg -debug 1 -xerror -f v4l2 -channel 1 -video_size 720x576
-pix_fmt yuyv422 -thread_queue_size 1024 -i /dev/video0 -f pulse -ar
44100 -ac 2 -channel_layout stereo -thread_queue_size 1024 -i
alsa_input.pci-0000_00_14.2.analog-stereo -c:a pcm_s16le -channel_layout
stereo -c:v ffv1 -level 3 -g 1 -aspect 4:3 -pix_fmt yuv422p -top 0
-vsync passthrough /Store3/Test/t_`date +%Y%m%d_%H%M`.mkv
./ffmpeg -debug 1 -xerror -f v4l2 -channel 1 -video_size 720x576
-pix_fmt yuyv422 -thread_queue_size 1024 -i /dev/video0 -f pulse -ar
44100 -ac 2 -channel_layout stereo -thread_queue_size 1024 -i
alsa_input.pci-0000_00_14.2.analog-stereo -c:v ffv1 -level 3 -g 1
-aspect 4:3 -pix_fmt yuv422p -top 0 -vsync passthrough -c:a pcm_s16le
-channel_layout stereo /Store3/Test/t_`date +%Y%m%d_%H%M`.mkv

I have the following error, always at previous: 1040
Non-monotonous DTS in output stream 0:0; previous: 1040, current:
-11163520; aborting.


When I remove all audio input and output
There is no error

When I only remove
-vsync passthrough
I don't get any error but a lot of dropped frames (28 dropped frames in
5 seconds capture)

One could say I should keep what is working fine. That's right but I am
looking for a way to get the both start timestamps audio and video in
the same value. At this time I get
start: 10452.776387
start: 1448108173.850955
There is the option -ts but after reading the doc I understand the
objective is to change the timestamps type, not to get same start time.
I can't find another option.

So 2 questions:
- Do you know an option to get sync start for audio and video?
- More for information: Why the precedence in the command line leads to
this error?

Thanks

For example with the last full command (note : previous: 1040)

./ffmpeg -debug 1 -xerror -f v4l2 -channel 1 -video_size 720x576
-pix_fmt yuyv422 -thread_queue_size 1024 -i /dev/video0 -f pulse -ar
44100 -ac 2 -channel_layout stereo -thread_queue_size 1024 -i
alsa_input.pci-0000_00_14.2.analog-stereo -c:v ffv1 -level 3 -g 1
-aspect 4:3 -pix_fmt yuv422p -top 0 -vsync passthrough -c:a pcm_s16le
-channel_layout stereo /Store3/Test/t_`date +%Y%m%d_%H%M`.mkv
ffmpeg version N-76674-g7ad698e Copyright (c) 2000-2015 the FFmpeg
developers
  built with gcc 5.1.1 (GCC) 20150618 (Red Hat 5.1.1-4)
  configuration: --enable-libpulse --enable-gpl --enable-libx264
  libavutil      55.  6.100 / 55.  6.100
  libavcodec     57. 15.100 / 57. 15.100
  libavformat    57. 14.100 / 57. 14.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6. 15.100 /  6. 15.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
 matched as AVOption 'debug' with argument '1'.
Reading option '-xerror' ... matched as option 'xerror' (exit on error)
with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with
argument 'v4l2'.
Reading option '-channel' ... matched as AVOption 'channel' with
argument '1'.
Reading option '-video_size' ... matched as AVOption 'video_size' with
argument '720x576'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel
format) with argument 'yuyv422'.
Reading option '-thread_queue_size' ... matched as option
'thread_queue_size' (set the maximum number of queued packets from the
demuxer) with argument '1024'.
Reading option '-i' ... matched as input file with argument '/dev/video0'.
Reading option '-f' ... matched as option 'f' (force format) with
argument 'pulse'.
Reading option '-ar' ... matched as option 'ar' (set audio sampling rate
(in Hz)) with argument '44100'.
Reading option '-ac' ... matched as option 'ac' (set number of audio
channels) with argument '2'.
Reading option '-channel_layout' ... matched as option 'channel_layout'
(set channel layout) with argument 'stereo'.
Reading option '-thread_queue_size' ... matched as option
'thread_queue_size' (set the maximum number of queued packets from the
demuxer) with argument '1024'.
Reading option '-i' ... matched as input file with argument
'alsa_input.pci-0000_00_14.2.analog-stereo'.
Reading option '-c:v' ... matched as option 'c' (codec name) with
argument 'ffv1'.
Reading option '-level' ... matched as AVOption 'level' with argument '3'.
Reading option '-g' ... matched as AVOption 'g' with argument '1'.
Reading option '-aspect' ... matched as option 'aspect' (set aspect
ratio (4:3, 16:9 or 1.3333, 1.7777)) with argument '4:3'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel
format) with argument 'yuv422p'.
Reading option '-top' ... matched as option 'top'
(top=1/bottom=0/auto=-1 field first) with argument '0'.
Reading option '-vsync' ... matched as option 'vsync' (video sync
method) with argument 'passthrough'.
Reading option '-c:a' ... matched as option 'c' (codec name) with
argument 'pcm_s16le'.
Reading option '-channel_layout' ... matched as option 'channel_layout'
(set channel layout) with argument 'stereo'.
Reading option '/Store3/Test/t_20151121_1202.mkv' ... matched as output
file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option xerror (exit on error) with argument 1.
Applying option vsync (video sync method) with argument passthrough.
Successfully parsed a group of options.
Parsing a group of options: input file /dev/video0.
Applying option f (force format) with argument v4l2.
Applying option pix_fmt (set pixel format) with argument yuyv422.
Applying option thread_queue_size (set the maximum number of queued
packets from the demuxer) with argument 1024.
Successfully parsed a group of options.
Opening an input file: /dev/video0.
[video4linux2,v4l2 @ 0x1db79e0] fd:3 capabilities:85220001
[video4linux2,v4l2 @ 0x1db79e0] Selecting input_channel: 1
[video4linux2,v4l2 @ 0x1db79e0] Current input_channel: 1, input_name:
S-Video, input_std: ffffff
[video4linux2,v4l2 @ 0x1db79e0] The V4L2 driver is using the interlaced mode
[video4linux2,v4l2 @ 0x1db79e0] Current standard: PAL, id: ff,
frameperiod: 1/25
[video4linux2,v4l2 @ 0x1db79e0] All info found
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 9657.809292, bitrate: 165888 kb/s
    Stream #0:0, 1, 1/1000000: Video: rawvideo, 1 reference frame (YUY2
/ 0x32595559), yuyv422, 720x576, 1/1000000, 165888 kb/s, 25 fps, 25 tbr,
1000k tbn, 1000k tbc
Successfully opened the file.
Parsing a group of options: input file
alsa_input.pci-0000_00_14.2.analog-stereo.
Applying option f (force format) with argument pulse.
Applying option ar (set audio sampling rate (in Hz)) with argument 44100.
Applying option ac (set number of audio channels) with argument 2.
Applying option channel_layout (set channel layout) with argument stereo.
Applying option thread_queue_size (set the maximum number of queued
packets from the demuxer) with argument 1024.
Successfully parsed a group of options.
Opening an input file: alsa_input.pci-0000_00_14.2.analog-stereo.
[pulse @ 0x1db99e0] All info found
Input #1, pulse, from 'alsa_input.pci-0000_00_14.2.analog-stereo':
  Duration: N/A, start: 1448107378.883586, bitrate: 1411 kb/s
    Stream #1:0, 1, 1/1000000: Audio: pcm_s16le, 44100 Hz, stereo, s16,
1411 kb/s
Successfully opened the file.
Parsing a group of options: output file /Store3/Test/t_20151121_1202.mkv.
Applying option c:v (codec name) with argument ffv1.
Applying option aspect (set aspect ratio (4:3, 16:9 or 1.3333, 1.7777))
with argument 4:3.
Applying option pix_fmt (set pixel format) with argument yuv422p.
Applying option top (top=1/bottom=0/auto=-1 field first) with argument 0.
Applying option c:a (codec name) with argument pcm_s16le.
Applying option channel_layout (set channel layout) with argument stereo.
Successfully parsed a group of options.
Opening an output file: /Store3/Test/t_20151121_1202.mkv.
Successfully opened the file.
detected 8 logical cores
[graph 0 input from stream 0:0 @ 0x1ddf960] Setting 'video_size' to
value '720x576'
[graph 0 input from stream 0:0 @ 0x1ddf960] Setting 'pix_fmt' to value '1'
[graph 0 input from stream 0:0 @ 0x1ddf960] Setting 'time_base' to value
'1/1000000'
[graph 0 input from stream 0:0 @ 0x1ddf960] Setting 'pixel_aspect' to
value '0/1'
[graph 0 input from stream 0:0 @ 0x1ddf960] Setting 'sws_param' to value
'flags=2'
[graph 0 input from stream 0:0 @ 0x1ddf960] Setting 'frame_rate' to
value '25/1'
[graph 0 input from stream 0:0 @ 0x1ddf960] w:720 h:576 pixfmt:yuyv422
tb:1/1000000 fr:25/1 sar:0/1 sws_param:flags=2
[format @ 0x1de92c0] compat: called with args=[yuv422p]
[format @ 0x1de92c0] Setting 'pix_fmts' to value 'yuv422p'
[auto-inserted scaler 0 @ 0x1dea760] Setting 'flags' to value 'bicubic'
[auto-inserted scaler 0 @ 0x1dea760] w:iw h:ih flags:'bicubic' interl:0
[format @ 0x1de92c0] auto-inserting filter 'auto-inserted scaler 0'
between the filter 'Parsed_null_0' and the filter 'format'
[AVFilterGraph @ 0x1de7ea0] query_formats: 4 queried, 2 merged, 1
already done, 0 delayed
[auto-inserted scaler 0 @ 0x1dea760] w:720 h:576 fmt:yuyv422 sar:0/1 ->
w:720 h:576 fmt:yuv422p sar:0/1 flags:0x4
[graph 1 input from stream 1:0 @ 0x1df9420] Setting 'time_base' to value
'1/44100'
[graph 1 input from stream 1:0 @ 0x1df9420] Setting 'sample_rate' to
value '44100'
[graph 1 input from stream 1:0 @ 0x1df9420] Setting 'sample_fmt' to
value 's16'
[graph 1 input from stream 1:0 @ 0x1df9420] Setting 'channel_layout' to
value '0x3'
[graph 1 input from stream 1:0 @ 0x1df9420] tb:1/44100 samplefmt:s16
samplerate:44100 chlayout:0x3
[audio format for output stream 0:1 @ 0x1df9640] Setting 'sample_fmts'
to value 's16'
[audio format for output stream 0:1 @ 0x1df9640] Setting
'channel_layouts' to value '0x3'
[AVFilterGraph @ 0x1dea8a0] query_formats: 4 queried, 9 merged, 0
already done, 0 delayed
Output #0, matroska, to '/Store3/Test/t_20151121_1202.mkv':
  Metadata:
    encoder         : Lavf57.14.100
    Stream #0:0, 0, 1/1000: Video: ffv1, 1 reference frame (FFV1 /
0x31564646), yuv422p, 720x576 [SAR 16:15 DAR 4:3], 1/25, q=2-31, 200
kb/s, 25 fps, 1k tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.15.100 ffv1
    Stream #0:1, 0, 1/1000: Audio: pcm_s16le ([1][0][0][0] / 0x0001),
44100 Hz, stereo, s16, 1411 kb/s
    Metadata:
      encoder         : Lavc57.15.100 pcm_s16le
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> ffv1 (native))
  Stream #1:0 -> #0:1 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
    Last message repeated 2 times
[matroska @ 0x1dd2c20] Writing block at offset 965, size 89644, pts 0,
dts 0, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 90617 bytes, pts
40dts 40
[matroska @ 0x1dd2c20] Writing block at offset 90632, size 65472, pts 0,
dts 0, duration 371, keyframe 1
[matroska @ 0x1dd2c20] Writing block at offset 156112, size 89815, pts
40, dts 40, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 245935 bytes, pts
80dts 80
[matroska @ 0x1dd2c20] Writing block at offset 245950, size 89084, pts
80, dts 80, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 335042 bytes, pts
120dts 120
[matroska @ 0x1dd2c20] Writing block at offset 335057, size 89616, pts
120, dts 120, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 424681 bytes, pts
160dts 160
[matroska @ 0x1dd2c20] Writing block at offset 424696, size 89188, pts
160, dts 160, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 513892 bytes, pts
200dts 200
[matroska @ 0x1dd2c20] Writing block at offset 513907, size 88924, pts
200, dts 200, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 602839 bytes, pts
240dts 240
[matroska @ 0x1dd2c20] Writing block at offset 602854, size 89198, pts
240, dts 240, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 692060 bytes, pts
280dts 280
[matroska @ 0x1dd2c20] Writing block at offset 692076, size 89351, pts
280, dts 280, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 781435 bytes, pts
320dts 320
[matroska @ 0x1dd2c20] Writing block at offset 781451, size 89235, pts
320, dts 320, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 870694 bytes, pts
360dts 360
[matroska @ 0x1dd2c20] Writing block at offset 870710, size 89462, pts
360, dts 360, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 960180 bytes, pts
400dts 400
[matroska @ 0x1dd2c20] Writing block at offset 960196, size 65472, pts
371, dts 371, duration 371, keyframe 1
[matroska @ 0x1dd2c20] Writing block at offset 1025676, size 89632, pts
400, dts 400, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 1115316 bytes, pts
440dts 440
[matroska @ 0x1dd2c20] Writing block at offset 1115332, size 88473, pts
440, dts 440, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 1203813 bytes, pts
480dts 480
[matroska @ 0x1dd2c20] Writing block at offset 1203829, size 88946, pts
480, dts 480, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 1292783 bytes, pts
520dts 520
[matroska @ 0x1dd2c20] Writing block at offset 1292799, size 89197, pts
520, dts 520, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 1382004 bytes, pts
560dts 560
[matroska @ 0x1dd2c20] Writing block at offset 1382020, size 88824, pts
560, dts 560, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 1470852 bytes, pts
600dts 600
[matroska @ 0x1dd2c20] Writing block at offset 1470868, size 89048, pts
600, dts 600, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 1559924 bytes, pts
640dts 640
[matroska @ 0x1dd2c20] Writing block at offset 1559940, size 89271, pts
640, dts 640, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 1649219 bytes, pts
680dts 680
[matroska @ 0x1dd2c20] Writing block at offset 1649235, size 89955, pts
680, dts 680, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 1739198 bytes, pts
720dts 720
[matroska @ 0x1dd2c20] Writing block at offset 1739214, size 89251, pts
720, dts 720, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 1828473 bytes, pts
760dts 760
[matroska @ 0x1dd2c20] Writing block at offset 1828489, size 65472, pts
742, dts 742, duration 371, keyframe 1
[matroska @ 0x1dd2c20] Writing block at offset 1893969, size 89788, pts
760, dts 760, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 1983765 bytes, pts
800dts 800
[matroska @ 0x1dd2c20] Writing block at offset 1983781, size 89193, pts
800, dts 800, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 2072982 bytes, pts
840dts 840
[matroska @ 0x1dd2c20] Writing block at offset 2072998, size 88752, pts
840, dts 840, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 2161758 bytes, pts
880dts 880
[matroska @ 0x1dd2c20] Writing block at offset 2161774, size 89386, pts
880, dts 880, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 2251168 bytes, pts
920dts 920
[matroska @ 0x1dd2c20] Writing block at offset 2251184, size 89426, pts
920, dts 920, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 2340618 bytes, pts
960dts 960
[matroska @ 0x1dd2c20] Writing block at offset 2340634, size 88311, pts
960, dts 960, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 2428953 bytes, pts
1000dts 1000
[matroska @ 0x1dd2c20] Writing block at offset 2428969, size 88929, pts
1000, dts 1000, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Starting new cluster at offset 2517906 bytes, pts
1040dts 1040
[matroska @ 0x1dd2c20] Writing block at offset 2517922, size 88831, pts
1040, dts 1040, duration 40, keyframe 1
[matroska @ 0x1dd2c20] Non-monotonous DTS in output stream 0:0;
previous: 1040, current: -9657800; aborting.
[AVIOContext @ 0x1de7b00] Statistics: 52 seeks, 114 writeouts
Conversion failed!




More information about the ffmpeg-user mailing list