
Recherche avancée
Médias (1)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (73)
-
Gestion des droits de création et d’édition des objets
8 février 2011, parPar défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;
-
Activation de l’inscription des visiteurs
12 avril 2011, parIl est également possible d’activer l’inscription des visiteurs ce qui permettra à tout un chacun d’ouvrir soit même un compte sur le canal en question dans le cadre de projets ouverts par exemple.
Pour ce faire, il suffit d’aller dans l’espace de configuration du site en choisissant le sous menus "Gestion des utilisateurs". Le premier formulaire visible correspond à cette fonctionnalité.
Par défaut, MediaSPIP a créé lors de son initialisation un élément de menu dans le menu du haut de la page menant (...) -
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
Sur d’autres sites (6817)
-
avformat/f_select : add support for more pixel formats for scene change score calculations
21 juillet 2019, par Limin Wangavformat/f_select : add support for more pixel formats for scene change score calculations
This avoids automatic conversions to rgb if scene change score is used in the expression.
Below is the tested results for the new added pixel format without autoscale to rgb24 :
1. AV_PIX_FMT_YUVJ420P
time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f lavfi \
"sws_flags=+accurate_rnd+bitexact ;movie=../fate-suite/svq3/Vertical400kbit.sorenson3.mov,select=gt(scene\,.25)"master :
pkt_pts=1620|tag:lavfi.scene_score=1.000000
pkt_pts=4140|tag:lavfi.scene_score=0.875036
pkt_pts=5800|tag:lavfi.scene_score=1.000000
pkt_pts=6720|tag:lavfi.scene_score=0.461625
pkt_pts=8160|tag:lavfi.scene_score=1.000000
pkt_pts=9760|tag:lavfi.scene_score=1.000000
pkt_pts=14080|tag:lavfi.scene_score=0.838916
pkt_pts=15700|tag:lavfi.scene_score=1.000000
pkt_pts=18500|tag:lavfi.scene_score=0.474948
pkt_pts=20040|tag:lavfi.scene_score=0.379700
pkt_pts=21760|tag:lavfi.scene_score=1.000000
./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f 0.71s user 0.01s system 99% cpu 0.721 totalpatch applied :
pkt_pts=1620|tag:lavfi.scene_score=1.000000
pkt_pts=4140|tag:lavfi.scene_score=0.668643
pkt_pts=5800|tag:lavfi.scene_score=0.996721
pkt_pts=6720|tag:lavfi.scene_score=0.357390
pkt_pts=8160|tag:lavfi.scene_score=0.886268
pkt_pts=9760|tag:lavfi.scene_score=0.926219
pkt_pts=14080|tag:lavfi.scene_score=0.650033
pkt_pts=15700|tag:lavfi.scene_score=1.000000
pkt_pts=18500|tag:lavfi.scene_score=0.316402
pkt_pts=20040|tag:lavfi.scene_score=0.269509
pkt_pts=21760|tag:lavfi.scene_score=1.000000
./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f 0.19s user 0.01s system 81% cpu 0.240 total2. AV_PIX_FMT_YUV420P
time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f lavfi \
"sws_flags=+accurate_rnd+bitexact ;movie=../Passengers_Breakfast_1080-sdr.mkv,select=gt(scene\,.2)"
master :
pkt_pts=3587|tag:lavfi.scene_score=0.462364
pkt_pts=4838|tag:lavfi.scene_score=0.419519
pkt_pts=6548|tag:lavfi.scene_score=0.397027
pkt_pts=9968|tag:lavfi.scene_score=0.419245
pkt_pts=12471|tag:lavfi.scene_score=0.413084
pkt_pts=16225|tag:lavfi.scene_score=0.506370
pkt_pts=19645|tag:lavfi.scene_score=0.507538
pkt_pts=22314|tag:lavfi.scene_score=0.504319
pkt_pts=24817|tag:lavfi.scene_score=0.417544
pkt_pts=25651|tag:lavfi.scene_score=0.413916
pkt_pts=26652|tag:lavfi.scene_score=0.487707
18.58s user 0.07s system 99% cpu 18.663 totalpatch applied :
pkt_pts=3587|tag:lavfi.scene_score=0.272173
pkt_pts=4838|tag:lavfi.scene_score=0.247841
pkt_pts=6548|tag:lavfi.scene_score=0.233134
pkt_pts=9968|tag:lavfi.scene_score=0.247253
pkt_pts=12471|tag:lavfi.scene_score=0.244129
pkt_pts=16225|tag:lavfi.scene_score=0.302531
pkt_pts=19645|tag:lavfi.scene_score=0.303560
pkt_pts=22314|tag:lavfi.scene_score=0.301861
pkt_pts=24817|tag:lavfi.scene_score=0.249331
pkt_pts=25651|tag:lavfi.scene_score=0.247096
pkt_pts=26652|tag:lavfi.scene_score=0.287728
10.90s user 0.06s system 99% cpu 10.967 total3. AV_PIX_FMT_YUV422P
time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f lavfi \
"sws_flags=+accurate_rnd+bitexact ;movie=../Passengers_Breakfast_1080-sdr.mkv,format=yuv422p,select=gt(scene\,.2)"
master :patched applied :
pkt_pts=3587|tag:lavfi.scene_score=0.224017
pkt_pts=4838|tag:lavfi.scene_score=0.204225
pkt_pts=9968|tag:lavfi.scene_score=0.204636
pkt_pts=12471|tag:lavfi.scene_score=0.202772
pkt_pts=16225|tag:lavfi.scene_score=0.248765
pkt_pts=19645|tag:lavfi.scene_score=0.250144
pkt_pts=22314|tag:lavfi.scene_score=0.248802
pkt_pts=24817|tag:lavfi.scene_score=0.208362
pkt_pts=25651|tag:lavfi.scene_score=0.205777
pkt_pts=26652|tag:lavfi.scene_score=0.2307424. AV_PIX_FMT_YUV420P10
time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f lavfi \
"sws_flags=+accurate_rnd+bitexact ;movie=../Passengers_Breakfast_4k.mkv,select=gt(scene\,.2)"master :
pkt_pts=3587|tag:lavfi.scene_score=0.269890
pkt_pts=4838|tag:lavfi.scene_score=0.248957
pkt_pts=6548|tag:lavfi.scene_score=0.234619
pkt_pts=9969|tag:lavfi.scene_score=0.224912
pkt_pts=12471|tag:lavfi.scene_score=0.225158
pkt_pts=16225|tag:lavfi.scene_score=0.289809
pkt_pts=19645|tag:lavfi.scene_score=0.285013
pkt_pts=22314|tag:lavfi.scene_score=0.280295
pkt_pts=24817|tag:lavfi.scene_score=0.206486
pkt_pts=25651|tag:lavfi.scene_score=0.208556
pkt_pts=26652|tag:lavfi.scene_score=0.249577
./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f 76.03s user 0.22s system 99% cpu 1:16.27 totalpatch applied
pkt_pts=3587|tag:lavfi.scene_score=0.269890
pkt_pts=4838|tag:lavfi.scene_score=0.248957
pkt_pts=6548|tag:lavfi.scene_score=0.234619
pkt_pts=9969|tag:lavfi.scene_score=0.224912
pkt_pts=12471|tag:lavfi.scene_score=0.225158
pkt_pts=16225|tag:lavfi.scene_score=0.289809
pkt_pts=19645|tag:lavfi.scene_score=0.285013
pkt_pts=22314|tag:lavfi.scene_score=0.280295
pkt_pts=24817|tag:lavfi.scene_score=0.206486
pkt_pts=25651|tag:lavfi.scene_score=0.208556
pkt_pts=26652|tag:lavfi.scene_score=0.249577
./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f 50.27s user 0.20s system 99% cpu 50.476 total5. AV_PIX_FMT_RGBA, AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8
are tested by format= with the fate sample : Vertical400kbit.sorenson3.mov like below :
time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f lavfi \
"sws_flags=+accurate_rnd+bitexact ;movie=../fate-suite/svq3/Vertical400kbit.sorenson3.mov,format=rgba,select=gt(scene\,.25)"patch applied :
pkt_pts=1620|tag:lavfi.scene_score=1.000000
pkt_pts=4140|tag:lavfi.scene_score=0.656277
pkt_pts=5800|tag:lavfi.scene_score=1.000000
pkt_pts=6720|tag:lavfi.scene_score=0.346218
pkt_pts=8160|tag:lavfi.scene_score=0.987686
pkt_pts=9760|tag:lavfi.scene_score=1.000000
pkt_pts=14080|tag:lavfi.scene_score=0.629187
pkt_pts=15700|tag:lavfi.scene_score=1.000000
pkt_pts=18500|tag:lavfi.scene_score=0.356211
pkt_pts=20040|tag:lavfi.scene_score=0.284775
pkt_pts=21760|tag:lavfi.scene_score=1.0000006. AV_PIX_FMT_YUVJ422P
time ./ffprobe -of compact=p=0 -show_entries frame=pkt_pts:frame_tags -bitexact -f lavfi \
"sws_flags=+accurate_rnd+bitexact ;movie=../fate-suite/svq3/Vertical400kbit.sorenson3.mov,format=yuvj422p,select=gt(scene\,.25)"patch applied :
pkt_pts=1620|tag:lavfi.scene_score=0.838281
pkt_pts=4140|tag:lavfi.scene_score=0.541382
pkt_pts=5800|tag:lavfi.scene_score=0.780588
pkt_pts=6720|tag:lavfi.scene_score=0.298274
pkt_pts=8160|tag:lavfi.scene_score=0.699106
pkt_pts=9760|tag:lavfi.scene_score=0.730136
pkt_pts=14080|tag:lavfi.scene_score=0.537742
pkt_pts=15700|tag:lavfi.scene_score=0.811946
pkt_pts=18500|tag:lavfi.scene_score=0.263382
pkt_pts=21760|tag:lavfi.scene_score=0.880773Reviewed-by : Marton Balint <cus@passwd.hu>
Signed-off-by : Limin Wang <lance.lmwang@gmail.com> -
PyQt QGraphicsScene Render Scene As Video Format
28 mai 2024, par AlexI'm trying to allow the user to export the scene as an mp4 (video format), the items of the scene consists of QGraphicsVideoItem and multiple QGraphicsTextItem, I need to export the scene as it will allow the user to save the video with the text items. I've found one of the ways to do this but the issue is that it will take hours for a simple 5 seconds videos as it saves every image to a byte to create a video, every image is a millisecond. If I change from millisecond to seconds it could speed up but the video will not look as smooth, is there a more efficient way of doing this, without it taking so long ?


from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
from PySide6.QtSvgWidgets import *
from PySide6.QtMultimediaWidgets import QGraphicsVideoItem
from PySide6.QtMultimedia import QMediaPlayer, QAudioOutput, QMediaMetaData 

import subprocess

import sys

class ExportVideo(QThread):
 def __init__(self, video_item, video_player, graphics_scene, graphics_view):
 super().__init__()
 self.video_item = video_item
 self.video_player = video_player
 self.graphics_scene = graphics_scene
 self.graphics_view = graphics_view
 
 def run(self):
 self.video_player.pause()
 duration = self.video_player.duration()
 meta = self.video_player.metaData()


 # Prepare a pipe for ffmpeg to write to
 ffmpeg_process = subprocess.Popen(['ffmpeg', '-y', '-f', 'image2pipe', '-r', '1000', '-i', '-', '-c:v', 'libx265', '-pix_fmt', 'yuv420p', 'output.mp4'], stdin=subprocess.PIPE)

 for duration in range(0, duration):
 self.video_player.setPosition(duration)

 # Add logic to render the frame here
 print("Exporting frame:", duration) 

 image = QImage(self.graphics_scene.sceneRect().size().toSize(), QImage.Format_ARGB32)
 painter = QPainter(image)
 self.graphics_scene.render(painter)
 painter.end()

 # Convert QImage to bytes
 byte_array = QByteArray()
 buffer = QBuffer(byte_array)
 buffer.open(QIODevice.WriteOnly)
 image.save(buffer, 'JPEG')

 # Write image bytes to ffmpeg process
 ffmpeg_process.stdin.write(byte_array.data())

 # Close the pipe to signal ffmpeg that all frames have been processed
 ffmpeg_process.stdin.close()
 ffmpeg_process.wait()


class PyVideoPlayer(QWidget):
 
 def __init__(self):
 super().__init__()

 self.text_data = []

 self.mediaPlayer = QMediaPlayer()
 self.audioOutput = QAudioOutput()

 self.graphics_view = QGraphicsView()
 self.graphic_scene = QGraphicsScene()

 self.graphics_view.setScene(self.graphic_scene)
 self.graphic_scene.setBackgroundBrush(Qt.black)
 self.graphics_view.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
 self.graphics_view.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)

 self.video_item = QGraphicsVideoItem()
 self.graphic_scene.addItem(self.video_item)
 self.save_video = QPushButton()
 
 layout = QVBoxLayout()
 layout.addWidget(self.graphics_view, stretch=1)
 layout.addWidget(self.save_video)
 self.setLayout(layout)

 # Slots Section
 self.mediaPlayer.setVideoOutput(self.video_item)
 self.mediaPlayer.positionChanged.connect(self.changeVideoPosition)
 self.save_video.clicked.connect(self.saveVideo)

 def setMedia(self, fileName):
 self.mediaPlayer.setSource(QUrl.fromLocalFile(fileName))
 self.mediaPlayer.setAudioOutput(self.audioOutput)
 self.play()
 self.video_item.setSize(self.mediaPlayer.videoSink().videoSize())

 self.text_item = QGraphicsTextItem()
 self.text_item.setPlainText("Test Dummy")
 self.text_item.setDefaultTextColor(Qt.white)
 font = QFont()
 font.setPointSize(90) 
 self.text_item.setFont(font)
 self.text_item.setPos(self.graphic_scene.sceneRect().x() + self.text_item.boundingRect().width(), self.graphic_scene.sceneRect().center().y() - self.text_item.boundingRect().height())
 self.graphic_scene.addItem(self.text_item)
 self.text_data.append("Test Dummy")

 def play(self):
 if self.mediaPlayer.playbackState() == QMediaPlayer.PlaybackState.PlayingState:
 self.mediaPlayer.pause()
 else:
 self.mediaPlayer.play()

 def changeVideoPosition(self, duration):
 if duration > 1000 and self.text_item.isVisible():
 print("Hide Text")
 self.text_item.hide()

 def resize_graphic_scene(self):
 self.graphics_view.fitInView(self.graphic_scene.sceneRect(), Qt.KeepAspectRatio)

 def showEvent(self, event):
 self.resize_graphic_scene()

 def resizeEvent(self, event):
 self.resize_graphic_scene()

 def saveVideo(self):
 self.videoExport = ExportVideo(self.video_item, self.mediaPlayer, self.graphic_scene, self.graphics_view)
 self.videoExport.start()

 


if __name__ == "__main__":
 app = QApplication(sys.argv)
 window = PyVideoPlayer()
 window.setMedia("example.mp4")
 window.setGeometry(100, 100, 400, 300) # Set the window size
 window.setWindowTitle("QGraphicsView Example")
 window.show()
 sys.exit(app.exec())




- 

- EDIT : Changed from PNG to JPEG, it speeds up the image.save, I also get this issue :
Assertion fctx->async_lock failed at C:/ffmpeg-n6.0/libavcodec/pthread_frame.c:155.
I think it must have to do with setting the video player position.




- EDIT : Changed from PNG to JPEG, it speeds up the image.save, I also get this issue :
-
Evolution #2370 : Activation d’une pétition et autres options relativement rares
21 février 2019, par tcharlss (*´_ゝ`)À lier au ticket #4180
PR fait : https://git.spip.net/dist/petitions/pulls/1