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

transmux: use stream based concatenation for clips #966

Merged
merged 4 commits into from
Nov 22, 2023

Conversation

emranemran
Copy link
Collaborator

Occasionally, the mp4s of very short clips might stutter as it crosses segment boundaries. This was caused by incorrect PTS between segments which in turn is a result of us clipping and re-encoding the first and last segments "locally". Using a stream based concatenation instead of file based concatenation readjusts the timestamps and prevents these issues.

Note: Eventually, all mp4s will be generated using stream based concatenation if this works well for clipping.

@emranemran emranemran requested review from thomshutt and mjh1 November 9, 2023 07:06
@emranemran emranemran force-pushed the emran/use-stream-based-concat branch from 6661ab8 to fba854e Compare November 9, 2023 07:11
Copy link

codecov bot commented Nov 9, 2023

Codecov Report

Merging #966 (266a888) into main (15bd8b2) will increase coverage by 0.47072%.
Report is 7 commits behind head on main.
The diff coverage is 54.63918%.

Additional details and impacted files

Impacted file tree graph

@@                 Coverage Diff                 @@
##                main        #966         +/-   ##
===================================================
+ Coverage   51.02313%   51.49385%   +0.47072%     
===================================================
  Files             65          65                 
  Lines           6744        6828         +84     
===================================================
+ Hits            3441        3516         +75     
+ Misses          3011        3009          -2     
- Partials         292         303         +11     
Files Coverage Δ
transcode/transcode.go 35.76642% <0.00000%> (-1.07569%) ⬇️
video/transmux.go 33.53659% <63.85542%> (+33.53659%) ⬆️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 15bd8b2...266a888. Read the comment docs.

Files Coverage Δ
transcode/transcode.go 35.76642% <0.00000%> (-1.07569%) ⬇️
video/transmux.go 33.53659% <63.85542%> (+33.53659%) ⬆️

... and 1 file with indirect coverage changes

video/transmux.go Outdated Show resolved Hide resolved
@emranemran
Copy link
Collaborator Author

Updates:

  • addressed comments
  • working on integration tests (might use a separate PR but trying to just get it done in this one)

Occasionally, the mp4s of very short clips might stutter as it crosses
segment boundaries. This was caused by incorrect PTS between segments
which in turn is a result of us clipping and re-encoding the first and
last segments "locally". Using a stream based concatenation instead of
file based concatenation readjusts the timestamps and prevents these
issues.

Note: Eventually, all mp4s will be generated using stream based
concatenation if this works well for clipping.
* split out ffmpeg calls to stream-concat into it's own mini function to
  follow the existing styles in the video package
* add deletion logic for all intermediary segment files
* All transmux ops used to happen within /tmp/transmux dir with unique
request-id based filenames. To make this cleaner, we now generate a
unique tmp folder per request where transmux ops are done.

* Also added logic to do a deferred removal of this tmp dir for each
request.
@emranemran emranemran force-pushed the emran/use-stream-based-concat branch 2 times, most recently from 32184c5 to ffdfaa7 Compare November 15, 2023 08:42
@emranemran
Copy link
Collaborator Author

Updates:

  • Added unit test since it made more sense than cucumber test for this case

@emranemran emranemran force-pushed the emran/use-stream-based-concat branch from ffdfaa7 to 2619fd7 Compare November 15, 2023 09:00
@emranemran emranemran force-pushed the emran/use-stream-based-concat branch from 2619fd7 to 266a888 Compare November 15, 2023 12:10
@emranemran emranemran merged commit 19aa630 into main Nov 22, 2023
12 checks passed
@emranemran emranemran deleted the emran/use-stream-based-concat branch November 22, 2023 17:46
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

Successfully merging this pull request may close these issues.

3 participants