Skip to content

Commit b215566

Browse files
committed
dcpaccess -unicode subtitles/x264 opts/subtitle language
1 parent a28aa16 commit b215566

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

dcpaccess.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@
6161
if args.p:
6262
codec = ['prores','-profile:v','3']
6363
else:
64-
codec = ['libx264','-pix_fmt','yuv420p', '-crf', '21']
64+
codec = ['libx264','-pix_fmt','yuv420p', '-crf', '19' '-veryfast']
6565

6666
if args.s:
6767
print '***********************************************'
6868
print 'You have chosen to burn in subtitles. This will take a long time. A better approach may be to make a clean transcode to a high quality format such as PRORES and make further clean or subtitled surrogates from that new copy. '
6969
print '***********************************************'
70-
time.sleep(5)
70+
time.sleep(1)
7171

7272
dcp_dir = args.input
7373
temp_dir = tempfile.gettempdir()
@@ -150,12 +150,19 @@
150150
print 'Please select which CPL youd like to process'
151151
chosen_cpl = raw_input()
152152
cpl_parse = etree.parse(cpl_list[int(chosen_cpl) - 1])
153-
153+
if args.s:
154+
cpl_namespace = cpl_parse.xpath('namespace-uri(.)')
155+
subtitle_language = cpl_parse.findall('//ns:MainSubtitle/ns:Language',namespaces={'ns': cpl_namespace})
156+
print 'This CPL contains ', subtitle_language[0].text, ' subtitles. Proceed?'
157+
subs_confirmation = raw_input('Y/N')
158+
if subs_confirmation not in ['Y','y']:
159+
print 'please run script again and choose different CPL' # use a while loop with a function to return to the cpl choice.
160+
sys.exit()
161+
154162

155-
156163
print cpl_parse
157164
cpl_namespace = cpl_parse.xpath('namespace-uri(.)')
158-
165+
subtitle_language = cpl_parse.findall('//ns:MainSubtitle/ns:Language',namespaces={'ns': cpl_namespace})
159166
xmluuid = cpl_parse.findall('//ns:MainPicture/ns:Id',namespaces={'ns': cpl_namespace})
160167
xmluuid_audio = cpl_parse.findall('//ns:MainSound/ns:Id',namespaces={'ns': cpl_namespace})
161168
xmluuid_subs = cpl_parse.findall('//ns:MainSubtitle/ns:Id',namespaces={'ns': cpl_namespace})
@@ -165,6 +172,7 @@
165172
intrinsic_audio = cpl_parse.findall('//ns:MainSound/ns:IntrinsicDuration',namespaces={'ns': cpl_namespace})
166173
entry_image = cpl_parse.findall('//ns:MainPicture/ns:EntryPoint',namespaces={'ns': cpl_namespace})
167174
entry_audio = cpl_parse.findall('//ns:MainSound/ns:EntryPoint',namespaces={'ns': cpl_namespace})
175+
168176
video_fps = cpl_parse.xpath('//ns:MainPicture/ns:EditRate',namespaces={'ns': cpl_namespace})
169177
for i in video_fps:
170178
print i, 'hjkhjkyuiyukhukhjkhj'
@@ -262,7 +270,10 @@
262270
print subs
263271
counter = 0
264272
count = len(subs)
265-
273+
if not len(subs) == len(pic_mxfs):
274+
print 'The amount of picture files does not equal the amount of subtitles. This feature is not supported yet. Sorry!'
275+
sys.exit()
276+
266277
while counter < count:
267278
srt_file = temp_dir + '/' + os.path.basename(subs[counter]) +'.srt'
268279
output_filename = os.path.basename(dcp_dir) + '_subs_reel' + str(counter + 1) + time.strftime("_%Y_%m_%dT%H_%M_%S")
@@ -302,7 +313,7 @@
302313
myfile.write(in_point + ' --> ' + out + '\n')
303314
bla = [bla.text for bla in xmlo.iterfind('.//Subtitle[%s]//Text' % int(counter2) ) ]
304315
for i in bla:
305-
myfile.write(i + '\n')
316+
myfile.write(i.encode("utf-8") + '\n')
306317
myfile.write('\n')
307318

308319
print 'Transforming ' + str(current_sub_counter) + ' of' + str(count) + ' subtitles\r' ,
@@ -379,7 +390,7 @@ def write_textfile(textfile, list_type):
379390

380391
# Removes PKLs from list of files to hash, as these files are not in manifest.
381392

382-
print pic_mxfs
393+
383394
if email == 'enabled':
384395
emailfrom = ""
385396
emailto = ['', '']

0 commit comments

Comments
 (0)