#4131: aresample=async=1000:first_pts=0 produced out-of-sync audio with Non-
monotonous DTS in output stream warnings
-------------------------------------+------------------------------------
             Reporter:  Mika Raento  |                    Owner:  (none)
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:  avfilter
              Version:  git-master   |               Resolution:
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+------------------------------------
Comment (by Gyan):

 I came across this bug independently a few months ago. However, I only
 recently had time to look into it. Turns out it's due to the resampling
 context getting reinitialized and losing the state of some variables.

 Patch sent to the ML. Will update link here.

 This is a brief demo of the behaviour.

 Command:

 `ffmpeg -f lavfi -copyts -i
 
sine=r=1000:samples_per_frame=100,asetpts='PTS+S+S*floor(ld(1)/4)+st(1,ld(1)+1)*0',atrim=end=1
 -af ashowinfo@pre,aresample=async=300:first_pts=0,ashowinfo@post -f null
 -`

 Input frames (ashowinfo@pre):

 {{{
 n:0 pts:100 pts_time:0.1 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:100 checksum:47DC65D2
 n:1 pts:200 pts_time:0.2 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:100 checksum:D55C67D0
 n:2 pts:300 pts_time:0.3 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:100 checksum:D55C67D0
 n:3 pts:400 pts_time:0.4 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:100 checksum:D55C67D0
 n:4 pts:600 pts_time:0.6 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:100 checksum:D55C67D0
 n:5 pts:700 pts_time:0.7 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:100 checksum:D55C67D0
 n:6 pts:800 pts_time:0.8 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:100 checksum:D55C67D0
 n:7 pts:900 pts_time:0.9 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:100 checksum:D55C67D0
 }}}

 Output frames - unpatched (ashowinfo@post):
 {{{
 n:0 pts:0 pts_time:0 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:132 checksum:C2981F45
 n:1 pts:132 pts_time:0.132 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:68 checksum:E78E468D
 n:2 pts:200 pts_time:0.2 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:100 checksum:D55C67D0
 n:3 pts:300 pts_time:0.3 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:100 checksum:D55C67D0
 n:4 pts:400 pts_time:0.4 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:100 checksum:D55C67D0
 n:5 pts:0 pts_time:0 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:93 checksum:85CA5DB4 plan
 n:6 pts:93 pts_time:0.093 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:148 checksum:E39B24BA
 n:7 pts:241 pts_time:0.241 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:618 checksum:9ECE66E4
 n:8 pts:859 pts_time:0.859 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:93 checksum:018B5C5C
 n:9 pts:952 pts_time:0.952 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:94 checksum:86695D43
 n:10 pts:1046 pts_time:1.046 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:16 checksum:02470F0D
 }}}

 Output frames - patched   (ashowinfo@post):
 {{{
 n:0 pts:0 pts_time:0 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:132 checksum:C2981F45
 n:1 pts:132 pts_time:0.132 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:68 checksum:E78E468D
 n:2 pts:200 pts_time:0.2 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:100 checksum:D55C67D0
 n:3 pts:300 pts_time:0.3 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:100 checksum:D55C67D0
 n:4 pts:400 pts_time:0.4 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:100 checksum:D55C67D0
 n:5 pts:500 pts_time:0.5 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:93 checksum:85CA5DB4
 n:6 pts:593 pts_time:0.593 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:110 checksum:A2655D0B
 n:7 pts:703 pts_time:0.703 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:108 checksum:95CB6F01
 n:8 pts:811 pts_time:0.811 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:108 checksum:F35668B8
 n:9 pts:919 pts_time:0.919 fmt:s16 channels:1 chlayout:mono rate:1000
 nb_samples:18 checksum:84C2130C
 }}}
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/4131#comment:8>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
_______________________________________________
FFmpeg-trac mailing list
FFmpeg-trac@avcodec.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-trac

To unsubscribe, visit link above, or email
ffmpeg-trac-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to