Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stuttery video (guessed frame durations of 'avc1' will probably be wrong!) #56

Closed
sentience opened this issue Jun 17, 2020 · 9 comments
Closed

Comments

@sentience
Copy link

Running master via Docker on macOS.

Info: version '56aee28-dirty' using ffmpeg '3.4.6-0ubuntu0.18.04.1'
Info: reading /mnt/ok.mp4
Info: parsing healthy moov atom ...
Composition time offset atom found. Out of order samples possible.

Info: reading mdat from truncated file ...
Info: Muted ffmpeg to reduce redundant warnings/errors. Use '-do' to see them.
Error: unable to find correct codec -> premature end (~100%)
try '-s' to skip unknown sequences

Warning: guessed frame durations of 'avc1' will probably be wrong!
Info: Found 142090 packets ( mp4a: 86640 avc1: 55450 avc1-keyframes: 617 )
Info: Duration of mp4a: 30min 48s 320ms (1848320 ms)
Info: Duration of avc1: 30min 48s 374ms (1848374 ms)
Info: saving /mnt/broken.mp4_fixed.mp4

2 warnings were hidden!

The broken.mp4_fixed.mp4 file plays, but stutters throughout in QuickTime Player. VLC plays it more smoothly, but with occasional pauses in the video and the audio is a little out-of-sync.

I'm guessing the “Warning: guessed frame durations of 'avc1' will probably be wrong!” is at the heart of the issue, here.

@sentience
Copy link
Author

Tried -a to analyze the file:

Info: version '56aee28-dirty' using ffmpeg '3.4.6-0ubuntu0.18.04.1'
Info: reading /mnt/ok.mp4
Info: parsing healthy moov atom ...
Composition time offset atom found. Out of order samples possible.

Track 0 codec: mp4a

(0) Size: 684 offset: 241621 / 241669 begin: 211a9495 baa8c640 end: ed3bbbf0211a94cd
Info: Muted ffmpeg to reduce redundant warnings/errors. Use '-do' to see them.
detected size: 684 true: 684
detected duration: 1024 true: 684 <- WRONG

(1) Size: 668 offset: 242305 / 242353 begin: 211a94cd ba8b61a3 end: 200dcc4e00000002
detected size: 668 true: 668
detected duration: 1024 true: 668 <- WRONG

(701) Size: 733 offset: 4304242 / 4304290 begin: 211a8fff 37700001 end: a77777e000000002
detected size: 733 true: 733
detected duration: 1024 true: 733 <- WRONG

(702) Size: 614 offset: 4305038 / 4305086 begin: 211a8ff9 fff80001 end: 7c80e1c000005b9d
detected size: 614 true: 614
detected duration: 1024 true: 614

Track 1 codec: avc1

(0) Size: 241621 offset: 0 / 48 begin: 00000002 09100000 end: 0000049d211a9495
detected size: 241621 true: 241621
detected keyframe: 1 true: 1

(1) Size: 6132 offset: 242973 / 243021 begin: 00000002 09300000 end: 32966ba0211a94dd
detected size: 6132 true: 6132

(448) Size: 58 offset: 4303355 / 4303403 begin: 00000002 09500000 end: 000011f1211a8fbf
detected size: 58 true: 58

(449) Size: 63 offset: 4304975 / 4305023 begin: 00000002 09300000 end: 030065c0211a8ff9
detected size: 63 true: 63

@sentience
Copy link
Author

Uploaded the files in case you need to take a look: https://we.tl/t-wQj90Je7uN

@anthwlock
Copy link
Owner

Here I explained the meaning/reason of guessed frame durations [..] will probably be wrong!.

One idea I had was to measure the playback length of each frame.
Don't expect a fix in the near future.

Btw, have you also used ffmpeg to save the stream? If not, what have you used instead?

@sentience
Copy link
Author

Yes, I used ffmpeg to save the stream. I truncated the file by accident by hitting Ctrl-C twice, at which point ffmpeg exited immediately.

@anthwlock
Copy link
Owner

anthwlock commented Jun 23, 2020

Interesting. I guess it would be worth digging into ffmpeg's source, to find out what's the cause for these non-constant durations, and to reason about if recovery is possible.
Specifically, its hls protocol demuxer implementation.

Btw, in case you haven't seen it, there is a simple trick to avoid corrupt files while streaming with ffmpeg.

@cbenhagen
Copy link

@anthwlock Could be the same issue or completely unrelated. I also get a stuttery result in QuickTime Player but am missing the "..guessed frame durations.." warning. Playing back in ffplay and VLC works normally. Any ideas? Do you want me to open a new issue as the warning is not present in my case?

Here is a sample: https://we.tl/t-hsqhlZeGYs

@anthwlock
Copy link
Owner

@cbenhagen yes, open another issue. Please include a working reference file, a longer video (>10s), and a detailed description on what you mean by "stuttery result". Try if using ffmpeg -c copy helps. I assume the working file plays fine with QuickTime Player?

@cbenhagen
Copy link

cbenhagen commented Jun 29, 2020

Will do. Yes the working file plays well. ffmpeg -c copy does not help. Unfortunately I can't provide a bigger sample as it is not my footage. By stuttery, I mean it looks like a key frame keeps being repeated. Hard to explain. Do you have access to a macOS machine? Maybe I can provide a screen recording.

@anthwlock
Copy link
Owner

This issues consisted of two issues:

  • Stuttery video in QuickTime, "fixed" here.
  • video and the audio is a little out-of-sync, not yet fixed.
    Maybe this idea from ponchio can help.

To avoid confusion, I think it is better close this issue, since the "stuttery video" part has been dealt with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants