
Recherche avancée
Médias (91)
-
GetID3 - Boutons supplémentaires
9 avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
-
Core Media Video
4 avril 2013, par
Mis à jour : Juin 2013
Langue : français
Type : Video
-
The pirate bay depuis la Belgique
1er avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
-
Exemple de boutons d’action pour une collection collaborative
27 février 2013, par
Mis à jour : Mars 2013
Langue : français
Type : Image
-
Exemple de boutons d’action pour une collection personnelle
27 février 2013, par
Mis à jour : Février 2013
Langue : English
Type : Image
Autres articles (71)
-
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...) -
XMP PHP
13 mai 2011, parDixit Wikipedia, XMP signifie :
Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)
Sur d’autres sites (7905)
-
Paperclip Upload Video Without Styles
16 mars 2017, par Moamen NaanouBackground :
In my app, there is a model has image attachment using paperclip gem, now as per new requirements, I have to let the same attachment accept MP4 video files as well and the only validation I have to implement is about file size.
Product Model (with image attachment only) :
class Product < ActiveRecord::Base
has_attached_file :file,
:styles => { medium: '300x300>', thumb: '100x100>' },
:processors => [:thumbnail],
:url => '/assets/:id/:style/:hash.:extension',
:hash_digest=>'SHA1',
:use_timestamp => false
validates_attachment_content_type :file, :content_type => /\A(image)\/.*\Z/
validates_attachment_size :file, :less_than => 5.megabytes
endSo after reading many related questions, to accept a video file as well, I’ve used
gem paperclip-av-transcoder
and installed ffmpeg (Mac) using :brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-frei0r --with-libas
Then finally I’ve revised my model to be :
class Product < ActiveRecord::Base
has_attached_file :file,
:styles => lambda {|file| if file.instance.is_image?
{ medium: '300x300>', thumb: '100x100>' }
elsif file.instance.is_video?
{:thumb => { :geometry => "100x100#", :format => 'jpg', :time => 10}}
end },
:processors => lambda {|file| if file.is_image?
[:thumbnail]
elsif file.is_video?
[:transcoder]
end},
:url => '/assets/:id/:style/:hash.:extension',
:hash_digest=>'SHA1',
:use_timestamp => false
validates_attachment_content_type :file, :content_type => /\A(image|video)\/.*\Z/
validates_attachment_size :file, :less_than => 5.megabytes
def is_video?
file_content_type =~ %r(video)
end
def is_image?
file_content_type =~ %r(image)
end
endNow the
file
field accepts both videos & images but the video shouldn’t be compressed, because if it is compressed, I will get IO Error [Closed Stream]Question :
I’m expecting compressed MP4 file to be received from Mobile client(through REST API) and I don’t want to generate any thumb image or any other style or do any processing on this video and without installing any processor (
ffmpeg
in my case) and if I did so currently, I’m getting the following error becauseImageMagic
doesn’t work with video files :Paperclip::Errors::NotIdentifiedByImageMagickError
Any ideas ?
-
QTableWidget and QProcess - update table based on multiple process results
9 mars 2017, par SpencerI have a python program that runs through a QTableWidget and for each item it runs a QProcess (an FFMPEG process to be exact). What I’m trying to do is update the "parent" cell when the process completes. Right now there is a for loop that goes through each row and launches a process for each, and connects the finished signal of that process to a "finished" function, which updates the QTableWidget cell. I’m just having trouble properly telling the function WHICH sell to update - right now I am passing it the index of the current row (seeing as it is being spawned by the for loop) but what happens is by the time the processes start to finish it will only get the last row in the table... I’m quite new to Python and PyQt so it is possible there is some fundamental thing I have wrong here !
I tried passing the actual QTabelWidgetItem instead of the index but I got this error : "RuntimeError : wrapped C/C++ object of type QTableWidgetItem has been deleted"
My code, the function "finished" and line #132 are the relevant ones :
import sys, os, re
from PyQt4 import QtGui, QtCore
class BatchTable(QtGui.QTableWidget):
def __init__(self, parent):
super(BatchTable, self).__init__(parent)
self.setAcceptDrops(True)
self.setColumnCount(4)
self.setColumnWidth(1,50)
self.hideColumn(3)
self.horizontalHeader().setStretchLastSection(True)
self.setHorizontalHeaderLabels(QtCore.QString("Status;Alpha;File;Full Path").split(";"))
self.doubleClicked.connect(self.removeProject)
def removeProject(self, myItem):
row = myItem.row()
self.removeRow(row)
def dragEnterEvent(self, e):
if e.mimeData().hasFormat('text/uri-list'):
e.accept()
else:
print "nope"
e.ignore()
def dragMoveEvent(self, e):
e.accept()
def dropEvent(self, e):
if e.mimeData().hasUrls:
for url in e.mimeData().urls():
chkBoxItem = QtGui.QTableWidgetItem()
chkBoxItem.setFlags(QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled)
chkBoxItem.setCheckState(QtCore.Qt.Unchecked)
rowPosition = self.rowCount()
self.insertRow(rowPosition)
self.setItem(rowPosition, 0, QtGui.QTableWidgetItem("Ready"))
self.setItem(rowPosition, 1, chkBoxItem)
self.setItem(rowPosition, 2, QtGui.QTableWidgetItem(os.path.split(str(url.toLocalFile()))[1]))
self.setItem(rowPosition, 3, QtGui.QTableWidgetItem(url.toLocalFile()))
self.item(rowPosition, 0).setBackgroundColor(QtGui.QColor(80, 180, 30))
class ffmpegBatch(QtGui.QWidget):
def __init__(self):
super(ffmpegBatch, self).__init__()
self.initUI()
def initUI(self):
self.edit = QtGui.QTextEdit()
cmdGroup = QtGui.QGroupBox("Commandline arguments")
fpsLbl = QtGui.QLabel("FPS:")
self.fpsCombo = QtGui.QComboBox()
self.fpsCombo.addItem("29.97")
self.fpsCombo.addItem("23.976")
hbox1 = QtGui.QHBoxLayout()
hbox1.addWidget(fpsLbl)
hbox1.addWidget(self.fpsCombo)
cmdGroup.setLayout(hbox1)
saveGroup = QtGui.QGroupBox("Output")
self.outputLocation = QtGui.QLineEdit()
self.browseBtn = QtGui.QPushButton("Browse")
saveLocationBox = QtGui.QHBoxLayout()
# Todo: add "auto-step up two folders" button
saveLocationBox.addWidget(self.outputLocation)
saveLocationBox.addWidget(self.browseBtn)
saveGroup.setLayout(saveLocationBox)
runBtn = QtGui.QPushButton("Run Batch Transcode")
mainBox = QtGui.QVBoxLayout()
self.table = BatchTable(self)
# TODO: add "copy from clipboard" feature
mainBox.addWidget(self.table)
mainBox.addWidget(cmdGroup)
mainBox.addWidget(saveGroup)
mainBox.addWidget(runBtn)
mainBox.addWidget(self.edit)
self.setLayout(mainBox)
self.setGeometry(300, 300, 600, 500)
self.setWindowTitle('FFMPEG Batch Converter')
# triggers/events
runBtn.clicked.connect(self.run)
def RepresentsInt(self, s):
try:
int(s)
return True
except ValueError:
return False
def run(self):
if (self.outputLocation.text() == ''):
return
for projIndex in range(self.table.rowCount()):
# collect some data
ffmpeg_app = "C:\\Program Files\\ffmpeg-20150702-git-03b2b40-win64-static\\bin\\ffmpeg"
frameRate = self.fpsCombo.currentText()
inputFile = self.table.model().index(projIndex,3).data().toString()
outputPath = self.outputLocation.text()
outputPath = outputPath.replace("/", "\\")
# format the input for ffmpeg
# find how the exact number range, stored as 'd'
imageName = os.path.split(str(inputFile))[1]
imageName, imageExt = os.path.splitext(imageName)
length = len(imageName)
d = 0
while (self.RepresentsInt(imageName[length-2:length-1]) == True):
length = length-1
d = d+1
inputPath = os.path.split(str(inputFile))[0]
inputFile = imageName[0:length-1]
inputFile = inputPath + "/" + inputFile + "%" + str(d+1) + "d" + imageExt
inputFile = inputFile.replace("/", "\\")
# format the output
outputFile = outputPath + "\\" + imageName[0:length-2] + ".mov"
# build the commandline
cmd = '"' + ffmpeg_app + '"' + ' -y -r ' + frameRate + ' -i ' + '"' + inputFile + '"' + ' -vcodec dnxhd -b:v 145M -vf colormatrix=bt601:bt709 -flags +ildct ' + '"' + outputFile + '"'
# launch the process
proc = QtCore.QProcess(self)
proc.finished.connect(lambda: self.finished(projIndex))
proc.setProcessChannelMode(proc.MergedChannels)
proc.start(cmd)
proc.readyReadStandardOutput.connect(lambda: self.readStdOutput(proc, projIndex, 100))
self.table.setItem(projIndex, 0, QtGui.QTableWidgetItem("Running..."))
self.table.item(projIndex, 0).setBackgroundColor(QtGui.QColor(110, 145, 30))
def readStdOutput(self, proc, projIndex, total):
currentLine = QtCore.QString(proc.readAllStandardOutput())
currentLine = str(currentLine)
frameEnd = currentLine.find("fps", 0, 15)
if frameEnd != -1:
m = re.search("\d", currentLine)
if m:
frame = currentLine[m.start():frameEnd]
percent = (float(frame)/total)*100
print "Percent: " + str(percent)
self.edit.append(str(percent))
self.table.setItem(projIndex, 0, QtGui.QTableWidgetItem("Encoded: " + str(percent) + "%"))
def finished(self, projIndex):
# TODO: This isn't totally working properly for multiple processes (seems to get confused)
print "A process completed"
print self.sender().readAllStandardOutput()
if self.sender().exitStatus() == 0:
self.table.setItem(projIndex, 0, QtGui.QTableWidgetItem("Encoded"))
self.table.item(projIndex, 0).setBackgroundColor(QtGui.QColor(45, 145, 240))
def main():
app = QtGui.QApplication(sys.argv)
ex = ffmpegBatch()
ex.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()(And yes I do know that my percentage update is totally wrong right now, still working on that...)
-
What is AVHWAccel, and how can I use it ?
15 mars 2017, par shintaroidI want to make use of hardware acceleration for decoding an h264 encoded MP4 file.
My computing environment :
Hardware: MacPro (2015 model)
Software: FFmpeg (installed by brew)Here is the output of
FFmpeg
command :$ffmpeg -hwaccels
Hardware acceleration methods:
vda
videotoolboxAccording to this document, there are two options for my environment, that is,
VDA
andVideoToolBox
. I triedVDA
in C++ :Codec = avcodec_find_decoder_by_name("h264_vda");
It kind of worked, but the output of the pixel format is
UYVY422
which I have trouble to deal with (any suggestion on how to renderUYVY422
inC++
? The ideal format isyuv420p
)So I want to try
VideotoolBox
, but there is no such simple thing like (it may work in the case of encoding though)Codec = avcodec_find_decoder_by_name("h264_videotoolbox");
It seems I should use
AVHWAccel
, but what isAVHWAccel
and how to use it ?Part of My C++ code :
for( unsigned int i = 0; i < pFormatCtx->nb_streams; i++ ){
if(pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO){
pCodecCtx = pFormatCtx->streams[i]->codec;
video_stream = pFormatCtx->streams[i];
if( pCodecCtx->codec_id == AV_CODEC_ID_H264 ){
//pCodec = avcodec_find_decoder(pCodecCtx->codec_id);
pCodec = avcodec_find_decoder_by_name("h264_vda");
break;
}
}
}
// open codec
if( pCodec ){
if((ret=avcodec_open2(pCodecCtx, pCodec, NULL)) < 0) {
....