コード例 #1
0
from ffmpeg import FFmpeg
import asyncio
import sys

ffscale = FFmpeg()


@ffscale.on('completed')
def on_complete():
    print("completed")


# @ffscale.on('progress')
# def on_ffprobe_progress(progress):
#     print(progress.resolution)

new_file = sys.argv[1] + "_scale"
filter_scale = "scale=" + sys.argv[2]

ffscale.input(sys.argv[1])
ffscale.output(new_file, {'filter_complex': filter_scale}, f='mp4')
loop = asyncio.get_event_loop()
loop.run_until_complete(ffscale.execute())
loop.close()
コード例 #2
0
ファイル: runVMAF.py プロジェクト: DengkeDu/videoAssessment
from ffmpeg import FFmpeg
import asyncio
import sys

resolution = ""
ffmpeg = FFmpeg()


@ffmpeg.on('progress')
def on_ffmpeg_progress(progress):
    if 'VMAF' in progress._fields:
        print(progress.VMAF)


ffmpeg.input(sys.argv[1])
ffmpeg.input(sys.argv[2])
ffmpeg.output("-", {'filter_complex': 'libvmaf'}, f="null")
loop = asyncio.get_event_loop()
loop.run_until_complete(ffmpeg.execute())
loop.close()
コード例 #3
0
ファイル: test_urllib.py プロジェクト: DengkeDu/python-ffmpeg
import urllib.request
from ffmpeg import FFmpeg
import asyncio

url = "https://alpha-obs.yunshicloud.com/7674F33E470D459E/QMTNRK_YUNSHI/D52CB54DB7FE4AB0AA8FF77C7093AB84/D01BEFCB93CA47E099513C78BDC7CB30.mp4"

#filename,headers = urllib.request.urlretrieve(url)

fileavi = "test.avi"
filename = "test.mp4"

ff = FFmpeg()

@ff.on('start')
def on_start(arguments):
    print('Arguments:', arguments)

@ff.on('progress')
def on_pregress(progress):
    print(progress)

ff.input(filename)
ff.input(fileavi)
ff.output("-",{'filter_complex':'psnr'},f="null")
loop = asyncio.get_event_loop()
loop.run_until_complete(ff.execute())
loop.close
コード例 #4
0
from ffmpeg import FFmpeg as ffmpeg

input_stream = ffmpeg.input('input.mp4', f='mp4')
output_stream = ffmpeg.output(input_stream, 'output.m3u8', format='hls', start_number=0, hls_time=5, hls_list_size=0)
ffmpeg.run(output_stream)
コード例 #5
0
from ffmpeg import FFmpeg
import asyncio
import sys

resolution = ""
ffprobe = FFmpeg(executable='ffprobe')


@ffprobe.on('progress')
def on_ffprobe_progress(progress):
    if 'resolution' in progress._fields:
        resolution = progress.resolution.replace("\n", "").replace("\r", "")
        print(resolution)


ffprobe.input(sys.argv[1])
loop = asyncio.get_event_loop()
loop.run_until_complete(ffprobe.execute())
loop.close()