How to use the moviepy.editor.ImageClip function in moviepy

To help you get started, we’ve selected a few moviepy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SenorPez / project-cars-replay-enhancer / test / integration_DefaultCards.py View on Github external
pcre_series_standings = SeriesStandingsWithChange(
        result_data.classification,
        size=source_video.size,
        **configuration)
    Image.fromarray(pcre_series_standings.to_frame()).save(
        output_prefix + '_series_standings.png')
    series_standings = mpy.ImageClip(pcre_series_standings.to_frame()).set_duration(20)

    pcre_champion = SeriesChampion(
        result_data.classification,
        size=source_video.size,
        **configuration)
    Image.fromarray(pcre_champion.to_frame()).save(
        output_prefix + '_champion.png')
    champion = mpy.ImageClip(pcre_champion.to_frame()).set_duration(20)

    output = mpy.concatenate_videoclips([
        starting_grid.fadeout(1),
        main_event,
        results.fadein(1).fadeout(1),
        series_standings.fadein(1)
    ], method="compose")
    output.write_videofile(output_prefix + '.mp4', fps=framerate)
github SenorPez / project-cars-replay-enhancer / replayenhancer / __init__.py View on Github external
output_prefix + '_series_standings.png')
            series_standings = mpy.ImageClip(
                pcre_series_standings.to_frame()).set_duration(20)

            end_titles.append(series_standings)
    except KeyError:
        try:
            _ = configuration['point_structure']
            pcre_series_standings = SeriesStandings(
                result_data.classification,
                size=source_video.size,
                **configuration)

            Image.fromarray(pcre_series_standings.to_frame()).save(
                output_prefix + '_series_standings.png')
            series_standings = mpy.ImageClip(
                pcre_series_standings.to_frame()).set_duration(20)

            end_titles.append(series_standings)
        except:
            pass

    if champion:
        pcre_series_champion = SeriesChampion(
            result_data.classification,
            size=source_video.size,
            **configuration)
        Image.fromarray(pcre_series_champion.to_frame()).save(
            output_prefix + '_series_champion.png')
        series_champion = mpy.ImageClip(
            pcre_series_champion.to_frame()).set_duration(20)
github mgaitan / radiocut_downloader / radiocut / __init__.py View on Github external
def write_output(audio_clip, output_filename, background=None, verbose=False):

    if not background:
        audio_clip.write_audiofile(
            output_filename,
            fps=16000,
            nbytes=2,
            bitrate='16k',
            verbose=verbose
        )
    else:
        clip = ImageClip(background, duration=audio_clip.duration)
        clip = clip.set_audio(audio_clip)
        clip.write_videofile(
            output_filename,
            fps=1,
            audio_fps=16000,
            audio_nbytes=2,
            audio_bitrate='16k',
            verbose=verbose
        )
github google / starthinker / starthinker / task / video / run.py View on Github external
# Requires working installation of ImageMagick
    try:
      clip = mp.TextClip(
        txt=effect['text']['message'], 
        color=effect['text'].get('color', '#666666'), 
        font=effect['text'].get('font', 'Courier'), 
        fontsize=effect['text'].get('size', 12), 
        align=effect['text'].get('align', 'center'), 
        kerning=effect['text'].get('kerning', 0)
      )

    # Alternate method using Pillow - no need to set position text is already positioned within image
    except:
      clip = (
        mp.ImageClip(
          get_text_image(effect)
        )
      )

    clip = clip.set_start(effect['duration']['start'])
    clip = clip.set_duration(effect['duration']['end'] - effect['duration']['start'])
    clip = clip.set_pos((effect['position']['width'], effect['position']['height']))

    if effect.get('fade', {}).get('in'):
      clip = clip.crossfadein(effect['fade']['in'])

    if effect.get('fade', {}).get('out'):
      clip = clip.crossfadeout(effect['fade']['out'])

    if effect.get('position', {}).get('rotate'):
      clip = clip.rotate(effect['position']['rotate'])
github google / starthinker / starthinker / task / video / run.py View on Github external
def get_effects(video, effect):

  if 'image' in effect:
    clip = (
      mp.ImageClip(
        effect['image']['file_or_url']
      )
    )

    clip = clip.set_start(effect['duration']['start'])
    clip = clip.set_duration(effect['duration']['end'] - effect['duration']['start'])
    clip = clip.set_pos((effect['position']['width'], effect['position']['height']))

    if effect.get('fade', {}).get('in'):
      clip = clip.crossfadein(effect['fade']['in'])

    if effect.get('fade', {}).get('out'):
      clip = clip.crossfadeout(effect['fade']['out'])

    if effect.get('position', {}).get('rotate'):
      clip = clip.rotate(effect['position']['rotate'])