Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1668097

Browse files
committed
Merge pull request#199 from cchampet/fix_pythonAppsPython2.6
Fix python apps - python2.6
2 parentsc5e936f +80e971c commit1668097

File tree

2 files changed

+52
-18
lines changed

2 files changed

+52
-18
lines changed

‎app/pyProcessor/pyprocessor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
importsys
1+
#!/usr/bin/env python
2+
23
importargparse# python2.7+
34

45
frompyAvTranscoderimportavtranscoderasav

‎app/pyThumbnail/pythumbnail.py

Lines changed: 50 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,56 @@
1-
importargparse# python2.7+
1+
#!/usr/bin/env python
22

33
frompyAvTranscoderimportavtranscoderasav
44

5-
# Create command-line interface
6-
parser=argparse.ArgumentParser(
7-
prog='pythumbnail',
8-
description='''Generate jpeg thumbnail from video/image.''',
9-
)
10-
11-
# requirements
12-
parser.add_argument('inputFileName',help='It could be any media file with at least one video stream (video, image...). Support file without extension.')
13-
# options
14-
parser.add_argument("-o","--outputFile",dest="outputFileName",default="thumbnail.jpg",help="Set the output filename (thumbnail.jpg by default). Must be with jpg extension!")
15-
parser.add_argument("-t","--time",dest="time",type=float,default=0,help="Set time (in seconds) of where to seek in the video stream to generate the thumbnail (0 by default).")
16-
parser.add_argument("-f","--frame",dest="frame",type=int,default=0,help="Set time (in frames) of where to seek in the video stream to generate the thumbnail (0 by default). Warning: priority to frame if user indicates both frame and time!")
17-
parser.add_argument("-w","--width",dest="width",type=int,default=0,help="Override the width of the thumbnail (same as input by default).")
18-
parser.add_argument("-he","--height",dest="height",type=int,default=0,help="Override the height of the thumbnail (same as input by default).")
19-
# Parse command-line
20-
args=parser.parse_args()
5+
6+
# Get command line arguments
7+
args= []
8+
try:
9+
# python2.7+
10+
importargparse
11+
12+
# Create command-line interface
13+
parser=argparse.ArgumentParser(
14+
prog='pythumbnail',
15+
description='''Generate jpeg thumbnail from video/image.''',
16+
)
17+
18+
# requirements
19+
parser.add_argument('inputFileName',help='It could be any media file with at least one video stream (video, image...). Support file without extension.')
20+
# options
21+
parser.add_argument("-o","--outputFile",dest="outputFileName",default="thumbnail.jpg",help="Set the output filename (thumbnail.jpg by default). Must be with jpg extension!")
22+
parser.add_argument("-t","--time",dest="time",type=float,default=0,help="Set time (in seconds) of where to seek in the video stream to generate the thumbnail (0 by default).")
23+
parser.add_argument("-f","--frame",dest="frame",type=int,default=0,help="Set time (in frames) of where to seek in the video stream to generate the thumbnail (0 by default). Warning: priority to frame if user indicates both frame and time!")
24+
parser.add_argument("-w","--width",dest="width",type=int,default=0,help="Override the width of the thumbnail (same as input by default).")
25+
parser.add_argument("-he","--height",dest="height",type=int,default=0,help="Override the height of the thumbnail (same as input by default).")
26+
# Parse command-line
27+
args=parser.parse_args()
28+
29+
exceptImportError:
30+
importoptparse
31+
32+
# Create command-line interface
33+
parser=optparse.OptionParser(
34+
usage='usage: %prog -i <file> -t|-f <time> [options]',
35+
prog='pythumbnail',
36+
description='''Generate jpeg thumbnail from video/image.''',
37+
)
38+
39+
# requirements
40+
parser.add_option("-i","--inputFile",dest='inputFileName',help='It could be any media file with at least one video stream (video, image...). Support file without extension.')
41+
# options
42+
parser.add_option("-o","--outputFile",dest="outputFileName",default="thumbnail.jpg",help="Set the output filename (thumbnail.jpg by default). Must be with jpg extension!")
43+
parser.add_option("-t","--time",dest="time",type="float",default=0,help="Set time (in seconds) of where to seek in the video stream to generate the thumbnail (0 by default).")
44+
parser.add_option("-f","--frame",dest="frame",type="int",default=0,help="Set time (in frames) of where to seek in the video stream to generate the thumbnail (0 by default). Warning: priority to frame if user indicates both frame and time!")
45+
parser.add_option("-w","--width",dest="width",type="int",default=0,help="Override the width of the thumbnail (same as input by default).")
46+
parser.add_option("--height",dest="height",type="int",default=0,help="Override the height of the thumbnail (same as input by default).")
47+
# Parse command-line
48+
args,other=parser.parse_args()
49+
50+
ifargs.inputFileNameisNone:
51+
print"An input file is required. Use -i / --inputFile."
52+
exit(1)
53+
2154

2255
# setup avtranscoder
2356
logger=av.Logger().setLogLevel(av.AV_LOG_QUIET)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp