def command_generator(file, segment_specify): sub = ' -segment_time %d' % segment_specify vcodec = video_codec(file) # LIMITED # if rate > 6e6 or segment_specify == 'LIMITED': # br = min(rate, 15e6) # sub += ' -b:v %d -maxrate %d -bufsize %d' % (br, 16e6, 16e6/1.5) # vcodec, segment_time = 'h264', 5 # SEGMENT_TIME # print('auto', segment_time, rate) return 'ffmpeg -i %s -vcodec %s -acodec aac -bsf:v h264_mp4toannexb -map 0:v:0 -map 0:a? -f segment -segment_list out.m3u8 %s out%%05d.ts' % ( safename(file), vcodec, sub)
def command_generator(file): sub = '' rate = bit_rate(file) vcodec = video_codec(file) segment_time = min(20, int((20 * 2 << 22) / (rate * 1.35))) #LIMITED if rate > 6e6 or argv[3] == 'LIMITED': br = min(rate, 15e6) sub += ' -b:v %d -maxrate %d -bufsize %d' % (br, 16e6, 16e6 / 1.5) vcodec, segment_time = 'h264', 5 #SEGMENT_TIME if argv[3].isnumeric(): sub += ' -segment_time %d' % float(argv[3]) else: sub += ' -segment_time %d' % segment_time return 'ffmpeg -i %s -vcodec %s -acodec aac -bsf:v h264_mp4toannexb -map 0:v:0 -map 0:a? -f segment -segment_list out.m3u8 %s out%%05d.ts' % ( safename(file), vcodec, sub)
def command_generator(file): sub = '' rate = bit_rate(file) vcodec = video_codec(file) max_bits = uploader().MAX_BYTES * 8 segment_time = min(10, int(max_bits / (rate * 1.35))) #LIMITED if rate > 6e6 or argv[3] == 'LIMITED': maxrate = max_bits / 20 / 2.5 sub += ' -b:v %d -maxrate %d -bufsize %d' % (min( rate, maxrate * 0.9), maxrate, maxrate / 1.5) vcodec, segment_time = 'h264', 10 #SEGMENT_TIME if argv[3].isnumeric(): sub += ' -segment_time %d' % float(argv[3]) else: sub += ' -segment_time %d' % segment_time return 'ffmpeg -i %s -vcodec %s -acodec aac -bsf:v h264_mp4toannexb -map 0:v:0 -map 0:a? -f segment -segment_list out.m3u8 %s out%%05d.ts' % ( safename(file), vcodec, sub)