Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-video-worker
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-video-worker
Commits
4e5144a2
Commit
4e5144a2
authored
Feb 09, 2018
by
muhammad-ammar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix auto generated images ffmpeg command
EDUCATOR-2294
parent
0529c52b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
8 deletions
+22
-8
video_worker/tests/data/test_instance_config.yaml
+1
-0
video_worker/tests/test_video_images.py
+19
-4
video_worker/video_images.py
+2
-4
No files found.
video_worker/tests/data/test_instance_config.yaml
View file @
4e5144a2
...
...
@@ -40,3 +40,4 @@ celery_deliver_queue: ""
global_timeout
:
40
instance_prefix
:
"
"
ffmpeg_compiled
:
"
ffmpeg"
video_worker/tests/test_video_images.py
View file @
4e5144a2
...
...
@@ -39,6 +39,25 @@ class VideoImagesTest(unittest.TestCase):
with
open
(
TEST_INSTANCE_YAML
,
'r'
)
as
stream
:
self
.
settings
=
yaml
.
load
(
stream
)
@patch.object
(
video_images
.
VideoImages
,
'generate'
,
return_value
=
[
'a/1.png'
])
@patch.object
(
video_images
.
VideoImages
,
'upload'
,
return_value
=
[
's3://images/a/1.png'
])
@patch.object
(
video_images
.
VideoImages
,
'update_val'
)
def
test_create_and_update
(
self
,
mock_update_val
,
mock_upload
,
mock_generate
):
"""
Verify that VideoImages.create_and_update method works as expected.
"""
video_images
.
VideoImages
(
video_object
=
MockVideo
,
work_dir
=
self
.
work_dir
,
source_file
=
self
.
source_file
,
jobid
=
101
,
settings
=
self
.
settings
)
.
create_and_update
()
self
.
assertTrue
(
mock_generate
.
called
)
mock_upload
.
assert_called_with
([
'a/1.png'
])
mock_update_val
.
assert_called_with
([
's3://images/a/1.png'
])
@data
(
{
'duration'
:
10
,
'positions'
:
[
1
,
4
,
7
],
...
...
@@ -57,10 +76,6 @@ class VideoImagesTest(unittest.TestCase):
"""
self
.
assertEqual
(
video_images
.
VideoImages
.
calculate_positions
(
duration
),
positions
)
@unittest.skipIf
(
'TRAVIS'
in
os
.
environ
and
os
.
environ
[
'TRAVIS'
]
==
'true'
,
'Skipping this test on Travis CI due to unavailability of required ffmpeg version.'
)
def
test_generate
(
self
):
"""
Verify that VideoImages.generate method works as expected.
...
...
video_worker/video_images.py
View file @
4e5144a2
...
...
@@ -91,10 +91,8 @@ class VideoImages(object):
generated_images
.
append
(
os
.
path
.
join
(
self
.
work_dir
,
'{}.png'
.
format
(
uuid4
()
.
hex
))
)
command
=
(
'{ffmpeg} -ss {position} -i {video_file} -vf '
r'select="gt(scene\,0.4)",scale={width}:{height}'
' -vsync 2 -vframes 1 {output_file}'
' -hide_banner -y'
.
format
(
command
=
(
'{ffmpeg} -ss {position} -i {video_file} -y -vf scale={width}:{height}'
' -vsync 2 -vframes 1 {output_file}'
.
format
(
ffmpeg
=
self
.
settings
[
'ffmpeg_compiled'
],
position
=
position
,
video_file
=
self
.
source_video_file
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment