Skip to content

Commit

Permalink
fix video recording, set fps for input
Browse files Browse the repository at this point in the history
  • Loading branch information
kuceb committed Nov 22, 2019
1 parent 36fdb2e commit 4d202f6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
9 changes: 8 additions & 1 deletion packages/driver/src/cy/video-recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ export function create (state, Cypress) {
audio: false,
video: {
// mediaSource: browser supported by user pref
// @ts-ignore
mediaSource: 'browser',
frameRate: {
exact: 30,
// ideal: 30,
// max: 30,
},
},
})
.then((stream) => {
Expand All @@ -14,9 +20,10 @@ export function create (state, Cypress) {
mimeType: 'video/webm',
}

// @ts-ignore
const mediaRecorder = new window.MediaRecorder(stream, options)

mediaRecorder.start(100)
mediaRecorder.start(200)

mediaRecorder.addEventListener('dataavailable', (e) => {
Cypress.action('recorder:frame', e.data)
Expand Down
12 changes: 9 additions & 3 deletions packages/server/lib/video_capture.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ module.exports = {

debugFrames("writing video frame")

# # wStream.write(data)
# pt.write(data)

# return

if wantsWrite
if not wantsWrite = pt.write(data)
pt.once "drain", ->
Expand Down Expand Up @@ -148,15 +153,15 @@ module.exports = {
if options.webmInput
cmd
.inputFormat('webm')
.videoFilters("scale=trunc(iw/2)*2:trunc(ih/2)*2")
.withFpsInput(18)
# .videoFilters("scale=trunc(iw/2)*2:trunc(ih/2)*2")
## same as above
# .videoFilters("crop='floor(in_w/2)*2:floor(in_h/2)*2'")
.videoFilters("crop='floor(in_w/2)*2:floor(in_h/2)*2'")

else
cmd
.inputFormat("image2pipe")
.inputOptions("-use_wallclock_as_timestamps 1")

cmd.save(name)

startCapturing()
Expand All @@ -181,6 +186,7 @@ module.exports = {
"-preset fast"
"-crf #{videoCompression}"
])
# .videoFilters("crop='floor(in_w/2)*2:floor(in_h/2)*2'")
.on "start", (command) ->
debug("compression started %o", { command })

Expand Down

1 comment on commit 4d202f6

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 4d202f6 Nov 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.7.0/linux-x64/circle-issue-1096-firefox-support-4d202f6b9b92e211a2f286b8cf27adae99c4e810-196674/cypress.zip
npm install https://cdn.cypress.io/beta/npm/3.7.0/circle-issue-1096-firefox-support-4d202f6b9b92e211a2f286b8cf27adae99c4e810-196672/cypress.tgz

Please sign in to comment.