Files
rk_pve/pve_editor.py
2025-10-21 11:08:13 +02:00

59 lines
2.1 KiB
Python

# People's Video Editor: high quality, GPU accelerated mp4 editor
# Copyright (C) 2025 Roz K <roz@rozk.net>
#
# This file is part of People's Video Editor.
#
# People's Video Editor is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# People's Video Editor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with People's Video Editor.
# If not, see <https://www.gnu.org/licenses/>.
from pyui.application import Application
application = Application()
application.MainLoop()
# import multiprocessing
# import cProfile
#
# from pyav.demuxer import Demuxer
# from pyav.decoder import Decoder
#
# demuxer = Demuxer('test.mp4')
#
# print(f"nb_streams = {demuxer.nb_streams}")
# print(f"video codec = {demuxer.video_stream.codec.description()}")
# print(f"audio codec = {demuxer.audio_stream.codec.description()}")
#
# cpu_count = multiprocessing.cpu_count()
#
# print(f"using {cpu_count} threads for video decoding")
#
# video_decoder = Decoder(demuxer.video_stream, cpu_count)
# audio_decoder = Decoder(demuxer.audio_stream, 1)
#
# num_video_frames = 0
# num_audio_frames = 0
#
# with cProfile.Profile() as pr:
# while True:
# packet = demuxer.read_packet()
# eof = (packet is None)
# if eof or demuxer.video_stream.contains(packet):
# video_frames = video_decoder.decode(packet)
# num_video_frames += len(video_frames)
# if eof or demuxer.audio_stream.contains(packet):
# audio_frames = audio_decoder.decode(packet)
# num_audio_frames += len(audio_frames)
# if eof:
# break
#
# print(f"num video frames: {num_video_frames}, audio frames: {num_audio_frames}")
# pr.print_stats()