Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
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
YZG
yzg-util
Commits
ae22eb78
Commit
ae22eb78
authored
May 28, 2020
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
压缩视频
parent
b3326fdb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
TestMediaHelper.java
yzg-util-image/src/test/java/helper/TestMediaHelper.java
+13
-3
No files found.
yzg-util-image/src/test/java/helper/TestMediaHelper.java
View file @
ae22eb78
...
@@ -26,6 +26,13 @@ public class TestMediaHelper {
...
@@ -26,6 +26,13 @@ public class TestMediaHelper {
return
f
.
getAbsolutePath
();
return
f
.
getAbsolutePath
();
}
}
private
String
getTargetFile
()
{
// 注意,路径应为文件在工程中的相对路径
File
f
=
new
File
(
"target/100M.mp4"
);
return
f
.
getAbsolutePath
();
}
@Test
@Test
public
void
testVideoFirstImage
()
throws
IOException
{
public
void
testVideoFirstImage
()
throws
IOException
{
if
(
isFirstImage
)
{
if
(
isFirstImage
)
{
...
@@ -69,8 +76,9 @@ public class TestMediaHelper {
...
@@ -69,8 +76,9 @@ public class TestMediaHelper {
private
void
testVideoZipFlv
(
float
size
,
float
quote
)
throws
EncoderException
{
private
void
testVideoZipFlv
(
float
size
,
float
quote
)
throws
EncoderException
{
String
file
=
getFile
();
String
file
=
getFile
();
String
targetFile
=
getTargetFile
();
String
name
=
String
.
format
(
"%s.size_%d.quot_%d.flv"
,
String
name
=
String
.
format
(
"%s.size_%d.quot_%d.flv"
,
f
ile
,
(
int
)
(
size
*
100
),
(
int
)
(
quote
*
100
));
targetF
ile
,
(
int
)
(
size
*
100
),
(
int
)
(
quote
*
100
));
MediaHelper
.
zipVideoFlv
(
file
,
name
,
size
,
(
int
)
(
MediaHelper
.
DEFAULT_BIT_RATE
*
quote
));
MediaHelper
.
zipVideoFlv
(
file
,
name
,
size
,
(
int
)
(
MediaHelper
.
DEFAULT_BIT_RATE
*
quote
));
}
}
...
@@ -100,8 +108,9 @@ public class TestMediaHelper {
...
@@ -100,8 +108,9 @@ public class TestMediaHelper {
private
void
testVideoZipMpeg
(
float
size
,
float
quote
)
throws
EncoderException
{
private
void
testVideoZipMpeg
(
float
size
,
float
quote
)
throws
EncoderException
{
String
file
=
getFile
();
String
file
=
getFile
();
String
targetFile
=
getTargetFile
();
String
name
=
String
.
format
(
"%s.size_%d.quot_%d.mpeg.mp4"
,
String
name
=
String
.
format
(
"%s.size_%d.quot_%d.mpeg.mp4"
,
f
ile
,
(
int
)
(
size
*
100
),
(
int
)
(
quote
*
100
));
targetF
ile
,
(
int
)
(
size
*
100
),
(
int
)
(
quote
*
100
));
MediaHelper
.
zipVideoMpeg
(
file
,
name
,
size
,
(
int
)
(
MediaHelper
.
DEFAULT_BIT_RATE
*
quote
));
MediaHelper
.
zipVideoMpeg
(
file
,
name
,
size
,
(
int
)
(
MediaHelper
.
DEFAULT_BIT_RATE
*
quote
));
}
}
...
@@ -129,8 +138,9 @@ public class TestMediaHelper {
...
@@ -129,8 +138,9 @@ public class TestMediaHelper {
private
void
testVideoZip3pg
(
float
size
,
float
quote
)
throws
EncoderException
{
private
void
testVideoZip3pg
(
float
size
,
float
quote
)
throws
EncoderException
{
String
file
=
getFile
();
String
file
=
getFile
();
String
targetFile
=
getTargetFile
();
String
name
=
String
.
format
(
"%s.size_%d.quot_%d.3pg"
,
String
name
=
String
.
format
(
"%s.size_%d.quot_%d.3pg"
,
f
ile
,
(
int
)
(
size
*
100
),
(
int
)
(
quote
*
100
));
targetF
ile
,
(
int
)
(
size
*
100
),
(
int
)
(
quote
*
100
));
MediaHelper
.
zipVideo3pg
(
file
,
name
,
size
,
(
int
)
(
MediaHelper
.
DEFAULT_BIT_RATE
*
quote
));
MediaHelper
.
zipVideo3pg
(
file
,
name
,
size
,
(
int
)
(
MediaHelper
.
DEFAULT_BIT_RATE
*
quote
));
}
}
}
}
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