Beispiel #1
0
        if fps == 0:
            fps = mediainfo.get_fps(infile)

        start_end_frame = frames - FADE_FRAMES
        cmd = 'ffmpeg -i ' + infile + ' -qscale:v 1 -vf "fade=in:0:' + str(FADE_FRAMES) + ',fade=out:' + str(start_end_frame) + ':' + str(FADE_FRAMES) + '" ' + outfile
        log.info(cmd)
        os.system(cmd)
        mpg_file_list.append(outfile)


log.info('MP3 > AIFF')
is_use_music = os.path.isfile(INPUT_MUSIC)
music_outfile = tmpdir + '/' + OUT_MUSIC

if is_use_music:
    total_video_length = mediainfo.get_length_str(total_frames, fps)
    cmd = 'sox -v ' + str(MUSIC_VOLUME) + ' ' + INPUT_MUSIC + ' ' + music_outfile + ' repeat ' + str(COUNT_MUSIC_REPEAT) + ' fade 1 ' + total_video_length + ' 1'
    log.info(cmd)
    os.system(cmd)
else:
    log.info('There is no ' + INPUT_MUSIC)


log.info('MPGs > MP4')
mpg_files_str = ''
for mpg_file in mpg_file_list:
    mpg_files_str = mpg_files_str + mpg_file + '|'

if is_use_music:
    cmd = 'ffmpeg -i concat:"' + mpg_files_str + '" -i ' + music_outfile + ' -filter_complex amix=inputs=2:duration=shortest -c:v libx264 -preset slow -crf ' + str(VIDEO_QUALITY) + ' -c:a aac -strict -2 -shortest ' + MP4_RESULT_FILE
else:
Beispiel #2
0
#!/usr/bin/python

import sys
import mediainfo

infile = sys.argv[1]
print 'file', infile

frames = mediainfo.get_frames(infile)
print 'frames', frames

fps = mediainfo.get_fps(infile)
print 'fps', fps

lenght = mediainfo.get_length_str(frames, fps)
print 'lenght', lenght

#frames 2817.18
#time 00:01:34
Beispiel #3
0
            fps = mediainfo.get_fps(infile)

        start_end_frame = frames - FADE_FRAMES
        cmd = 'ffmpeg -i ' + infile + ' -qscale:v 1 -vf "fade=in:0:' + str(
            FADE_FRAMES) + ',fade=out:' + str(start_end_frame) + ':' + str(
                FADE_FRAMES) + '" ' + outfile
        log.info(cmd)
        os.system(cmd)
        mpg_file_list.append(outfile)

log.info('MP3 > AIFF')
is_use_music = os.path.isfile(INPUT_MUSIC)
music_outfile = tmpdir + '/' + OUT_MUSIC

if is_use_music:
    total_video_length = mediainfo.get_length_str(total_frames, fps)
    cmd = 'sox -v ' + str(
        MUSIC_VOLUME
    ) + ' ' + INPUT_MUSIC + ' ' + music_outfile + ' repeat ' + str(
        COUNT_MUSIC_REPEAT) + ' fade 1 ' + total_video_length + ' 1'
    log.info(cmd)
    os.system(cmd)
else:
    log.info('There is no ' + INPUT_MUSIC)

log.info('MPGs > MP4')
mpg_files_str = ''
for mpg_file in mpg_file_list:
    mpg_files_str = mpg_files_str + mpg_file + '|'

if is_use_music: