Opened 3 years ago

Closed 10 months ago

#9337 closed defect (needs_more_info)

'atempo' didn't work unless '-map 0' was added

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

Description (last modified by markfilipak)

source.vob is here: https://www.dropbox.com/s/bdahs4n08z120z6/source.vob?dl=0

To reproduce the issue, run 1.cmd .. 5.cmd. That will take less than a minute. Then read the rest of this report.

1.cmd => ffmpeg -i source.vob -filter_complex "[0:v]settb=expr=1/24,setpts=expr=N[v]" -map "[v]" -map 0:1 -codec:v %AVcoder% -codec:a copy -r 24 1.mkv

2.cmd => ffmpeg -i source.vob -filter_complex "[0:v]settb=expr=1/24,setpts=expr=N[v];[0:a]atempo=1.001[a]" -map "[v]" -map "[a]" -codec:v %AVcoder% -codec:a ac3 -r 24 2.mkv

3.cmd => ffmpeg -i source.vob -filter_complex "[0:v]settb=expr=1/24,setpts=expr=N[v];[0:a]atempo=1.001[a]" -map 0 -map "[v]" -map "[a]" -codec:v %AVcoder% -codec:a ac3 -r 24 3.mkv

4.cmd => ffmpeg -i 3.mkv -map 0:0 -map 0:1 -codec:v copy -codec:a copy 4.mkv

5.cmd => ffmpeg -i 3.mkv -map 0:2 -map 0:3 -codec:v copy -codec:a copy 5.mkv

source.vob has a 9-&-1/2 second clip that's repeated 7 more times. The clip is soft telecined. And of course, the video and audio are synchronized.
1.mkv, 2.mkv, 3.mkv were made by converting the soft telecined source to 24fps.
4.mkv, 5.mkv, were made from 3.mkv.

1.mkv was made just to show that the audio lags the video at the end of the 8th clip. Note the boy slamming the door. By the end of the 8th clip, it lags by about 1/2 second.
2.mkv is what I expected would produce synchronized audio, but it fails.
3.mkv appears to work when played with MPV, but there's an extra video track and an extra audio track.

4.mkv is just the 1st video & audio pair of tracks from 3.mkv.
5.mkv is just the 2nd video & audio pair.

4.mkv is what I want, so output tracks 0:0 & 0:1 must be from the graph.
5.mkv is not what I want, so output tracks 0:2 & 0:3 must be from '-map 0'.

Issue #1: Why does 'atempo' need '-map 0' to work?
Issue #2: Will what I want always be 0:0 & 0:1?

1.mkv, 2.mkv, 3.mkv, 4.mkv, 5.mkv are available on request.
1.log, 2.log, 3.log, 4.log, 5.log are available on request.

Regards, And Thank You for ffmpeg.
Mark Filipak.

Attachments (10)

1.cmd (150 bytes ) - added by markfilipak 3 years ago.
2.cmd (172 bytes ) - added by markfilipak 3 years ago.
3.cmd (179 bytes ) - added by markfilipak 3 years ago.
4.cmd (74 bytes ) - added by markfilipak 3 years ago.
5.cmd (74 bytes ) - added by markfilipak 3 years ago.
1.log (7.7 KB ) - added by markfilipak 3 years ago.
2.log (7.9 KB ) - added by markfilipak 3 years ago.
3.log (11.3 KB ) - added by markfilipak 3 years ago.
4.log (3.5 KB ) - added by markfilipak 3 years ago.
5.log (3.5 KB ) - added by markfilipak 3 years ago.

Download all attachments as: .zip

Change History (19)

comment:1 by markfilipak, 3 years ago

Component: undeterminedffmpeg
Description: modified (diff)

comment:2 by Gyan, 3 years ago

-map 0 -map "[v]" -map "[a]" will first include the source (unmodified) tracks and then the filtered tracks. Check the stream mapping in the log of 3.cmd

by markfilipak, 3 years ago

Attachment: 1.cmd added

by markfilipak, 3 years ago

Attachment: 2.cmd added

by markfilipak, 3 years ago

Attachment: 3.cmd added

by markfilipak, 3 years ago

Attachment: 4.cmd added

by markfilipak, 3 years ago

Attachment: 5.cmd added

by markfilipak, 3 years ago

Attachment: 1.log added

by markfilipak, 3 years ago

Attachment: 2.log added

by markfilipak, 3 years ago

Attachment: 3.log added

by markfilipak, 3 years ago

Attachment: 4.log added

by markfilipak, 3 years ago

Attachment: 5.log added

in reply to:  2 comment:3 by markfilipak, 3 years ago

Replying to Gyan:

-map 0 -map "[v]" -map "[a]" will first include the source (unmodified) tracks and then the filtered tracks. Check the stream mapping in the log of 3.cmd

From 3.log, you can't tell which output tracks are from the graph and which tracks are from '-map 0'.

comment:4 by markfilipak, 3 years ago

Sorry, I guess replying to the email doesn't work. So, I'll repeat my reply here, now.

Hi Gyan, Thanks.

Actually, it's the other way around; [0:0] & [0:1] are from the graph and [0:3] & [0:4] are from '-map 0'. Yes, that was surprising, but it's not really the issue.

Do you want 1.mkv..5.mkv?
With the source -- link provided -- and the scripts,
you can generate 1.mkv..5.mkv in less than a minute,
but I'll attach them if you prefer.

The issue is that without '-map 0', 'atempo' doesn't function. That can be seen by watching the last 10 seconds of 2.mkv (without '-map 0') v. the last 10 seconds of 3.mkv (with '-map 0').

3.cmd fixes that -- see 3.mkv -- but the '-map 0' adds the extra tracks.

4.mkv & 5.mkv show which tracks were added by the graph and which were added by '-map 0'.

  • Mark.
Last edited 3 years ago by markfilipak (previous) (diff)

in reply to:  4 ; comment:5 by Gyan, 3 years ago

Replying to markfilipak:

Sorry, I guess replying to the email doesn't work. So, I'll repeat my reply here, now.

Hi Gyan, Thanks.

Actually, it's the other way around; [0:0] & [0:1] are from the graph and [0:3] & [0:4] are from '-map 0'. Yes, that was surprising, but it's not really the issue.

Check again. From 3.log


Stream #0:0 -> #0:0 (mpeg2video (native) -> hevc (libx265))
Stream #0:1 -> #0:1 (ac3 (native) -> ac3 (native))
setpts (graph 0) -> Stream #0:2 (libx265)
atempo (graph 0) -> Stream #0:3 (ac3)

Last edited 3 years ago by Gyan (previous) (diff)

in reply to:  5 ; comment:6 by markfilipak, 3 years ago

Replying to Gyan:

Replying to markfilipak:

Sorry, I guess replying to the email doesn't work. So, I'll repeat my reply here, now.

Hi Gyan, Thanks.

Actually, it's the other way around; [0:0] & [0:1] are from the graph and [0:3] & [0:4] are from '-map 0'. Yes, that was surprising, but it's not really the issue.

Check again. From 3.log


Stream #0:0 -> #0:0 (mpeg2video (native) -> hevc (libx265))
Stream #0:1 -> #0:1 (ac3 (native) -> ac3 (native))
setpts (graph 0) -> Stream #0:2 (libx265)
atempo (graph 0) -> Stream #0:3 (ac3)

A sidetrack: Ah! You're right. Sorry. But something is strange. 4.mkv is:

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

and has synchonized audio as shown when the boy slams the screen door (so 'atempo' in the graph worked for them), while 5.mkv is:

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

(so are from '-map 0').
Something is backwards.

To the real issue, why does 'atempo' not work unless I add '-map 0'?

in reply to:  6 comment:7 by markfilipak, 3 years ago

I've given it some thought. Since 4.mkv & 5.mkv are made from 3.mkv, 3.log must be showing the mapping wrongly. It appears there's a second problem there.

-EDIT- On third thought, maybe 4.cmd & 5.cmd are not mapping properly, eh? I see the mapping as follows:

3.mkv...........4.mkv..5.mkv
graph -> 0:0 -> 0:0
graph -> 0:1 -> 0:1          door slam is correct ('atempo' worked)
input -> 0:2 --------> 0:0
input -> 0:3 --------> 0:1   door slam is late
Last edited 3 years ago by markfilipak (previous) (diff)

comment:8 by markfilipak, 3 years ago

I spent the last week creating a very complicated Windows script, but now I'm ready to follow-up on this ticket.
In the last few minutes I altered the script to save the intermediate (temp) file (before stripping out the duplicate streams) that has all the original streams, doubled.
You are correct and I was wrong: The 1st set of streams are from '-map 0' and the 2nd set of streams are the ones added by '-filter_complex "[0:v]settb=expr=1/24,setpts=expr=N[v];[0:a]atempo=1.001[a]" -map "[v]" -map "[a]"' -- I used MKVToolNixGUI to figure it out, saving the lower numbered streams to one output and the higher numbered streams to another output.

I don't know how my mistake happened and I appolgize for it -- having a script should avoid such a mistake in the future.

I'm going to do more testing with more movies to see whether the sets of streams (one from '-map 0' and the other from the '-filter_complex') remain reproduceable.

The bottom line remains: Without '-map 0' in the command, 'atempo' does not take affect.

Should I prepare an entire new presentation and ticket, or should I append a new presentation to this ticket? Your call.

Regards,
-Mark.

comment:9 by Elon Musk, 10 months ago

Resolution: needs_more_info
Status: newclosed

Needs simplified report.

Note: See TracTickets for help on using tickets.