
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 (24)
-
Demande de création d’un canal
12 mars 2010, parEn fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...) -
Librairies et logiciels spécifiques aux médias
10 décembre 2010, parPour un fonctionnement correct et optimal, plusieurs choses sont à prendre en considération.
Il est important, après avoir installé apache2, mysql et php5, d’installer d’autres logiciels nécessaires dont les installations sont décrites dans les liens afférants. Un ensemble de librairies multimedias (x264, libtheora, libvpx) utilisées pour l’encodage et le décodage des vidéos et sons afin de supporter le plus grand nombre de fichiers possibles. Cf. : ce tutoriel ; FFMpeg avec le maximum de décodeurs et (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir
Sur d’autres sites (6231)
-
C++ OpenCV 3.4 / FFMPEG 3.4.1 VideoWriter and MP4 Output File Format
11 janvier 2019, par PhilBotI’m running on an ARM BeagleBone X-15 Debian machine with Linux Kernel 4.9.35-ti-r44. In my C++ ( Qt 5 ) application, I want to save my cv::Mat frames to an MP4 format video. I have libx264 installed and compiled from scratch both ffmpeg and OpenCv. I can successfully record and view video with MJPEG with the AVI video container type but not MP4. Whenever I try to write an MP4 video, I get run time errors of the form :
OpenCV: FFMPEG: tag 0x44495658/'XVID' is not supported with codec id 13 and format 'mp4 / MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x00000020/' ???'I’ve tried various Google answers but none have worked.
Relevant code :
cv::Size frameSize = frame.size();
qDebug() << "Initializing Video Recording to save Video file here: " << destinationFileName;
std::string filename = destinationFileName.toStdString();
//int fcc = CV_FOURCC('M','J','P','G');
//int fcc = CV_FOURCC('X','2','6','4');
int fcc = CV_FOURCC('X','V','I','D');
int fps = 1;
videoRecorder = new cv::VideoWriter(filename,fcc,fps,frameSize);
...
videoRecorder->write(frame);I’ve downloaded and built the latest OpenCV 3.4 but the problem persists.
How can I write to an MP4 File with OpenCV’s video writer ?When I try the ’X’,’2’,’6’,’4’ format I get the error :
Initializing Video Recording to save Video file here: "/tmp/Garage.mp4"
OpenCV: FFMPEG: tag 0x34363258/'X264' is not supported with codec id 28 and format 'mp4 / MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x31637661/'avc1'
[h264_v4l2m2m @ 0x81042020] Could not find a valid device
[h264_v4l2m2m @ 0x81042020] can't configure encoder
Could not open codec 'h264_v4l2m2m': Unspecified error
StartingWhen I try the ’X’,’V’,’I’,’D’ format I get the error :
Initializing Video Recording to save Video file here: "/tmp/Garage.mp4"
OpenCV: FFMPEG: tag 0x44495658/'XVID' is not supported with codec id 13 and format 'mp4 / MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'
StartingWhen I try the ’M’,’P’,’E’,’G’ format I get the error :
Initializing Video Recording to save Video file here: "/tmp/Garage.mp4"
OpenCV: FFMPEG: tag 0x4745504d/'MPEG' is not supported with codec id 2 and format 'mp4 / MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'
StartingWhen I try the ’H’,’2’,’6’,’4’ format I get the error :
OpenCV: FFMPEG: tag 0x34363248/'H264' is not supported with codec id 28 and format 'mp4 / MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x31637661/'avc1'
[h264_v4l2m2m @ 0x7fdde340] Could not find a valid device
[h264_v4l2m2m @ 0x7fdde340] can't configure encoder
Could not open codec 'h264_v4l2m2m': Unspecified error
StartingWhen I try the ’M’,’P’,’4’,’V’ format I get the error :
Initializing Video Recording to save Video file here: "/tmp/Garage.mp4"
OpenCV: FFMPEG: tag 0x5634504d/'MP4V' is not supported with codec id 13 and format 'mp4 / MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'
StartingWhen I try the ’A’,’V’,’C’,’1’ format I get the error :
Initializing Video Recording to save Video file here: "/tmp/Garage.mp4"
OpenCV: FFMPEG: tag 0x31435641/'AVC1' is not supported with codec id 28 and format 'mp4 / MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x31637661/'avc1'
[h264_v4l2m2m @ 0x810f5f50] Could not find a valid device
[h264_v4l2m2m @ 0x810f5f50] can't configure encoder
Could not open codec 'h264_v4l2m2m': Unspecified error
StartingWhen I try the ’D’,’I’,’V’,’X’ format I get the error :
Initializing Video Recording to save Video file here: "/tmp/Garage.mp4"
OpenCV: FFMPEG: tag 0x58564944/'DIVX' is not supported with codec id 13 and format 'mp4 / MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'
StartingWhen I try the 0x21 format I get the error :
Initializing Video Recording to save Video file here: "/tmp/Garage.mp4"
OpenCV: FFMPEG: tag 0x00000021/'!???' is not found (format 'mp4 / MP4 (MPEG-4 Part 14)')'
StartingHere is my complete class which shows all tried formats :
#include "downloader.h"
Downloader::Downloader(QString url, QString destinationFile) : downloadUrl(url) , destinationFileName(destinationFile)
{
didInitializeVideoWriter = false;
qDebug() << "Initialized Downloader...";
}
Downloader::~Downloader() {
videoRecorder->release();
delete videoRecorder;
}
void Downloader::doDownload()
{
networkManager = new QNetworkAccessManager(this);
connect(networkManager, SIGNAL(finished(QNetworkReply*)),
this, SLOT(replyFinished(QNetworkReply*)));
networkManager->get(QNetworkRequest(QUrl(downloadUrl)));
}
void Downloader::writeFrame(cv::Mat frame) {
QMutexLocker locker(&videoFrameMutex);
videoRecorder->write(frame);
}
void Downloader::replyFinished(QNetworkReply *reply)
{
if(reply->error())
{
qDebug() << "ERROR!";
qDebug() << reply->errorString();
}
else
{
//qDebug() << reply->header(QNetworkRequest::ContentTypeHeader).toString();
//qDebug() << reply->header(QNetworkRequest::LastModifiedHeader).toDateTime().toString();
//qDebug() << reply->header(QNetworkRequest::ContentLengthHeader).toULongLong();
qDebug() << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
qDebug() << reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString();
QString tempFileName = destinationFileName;
QString jpegTempFilename = QString("%1").arg(tempFileName.replace("mp4","jpeg"));
qDebug() << "Overwriting: " << jpegTempFilename;
QFile *file = new QFile(jpegTempFilename);
if(file->open(QFile::WriteOnly))
{
file->write(reply->readAll());
file->flush();
file->close();
}
delete file;
cv::Mat frame = imread(jpegTempFilename.toStdString(), CV_LOAD_IMAGE_COLOR); // CV_LOAD_IMAGE_COLOR (>0) loads the image in the BGR format
cv::cvtColor(frame,frame,CV_BGR2RGB);
// Now lazy load the recorder
if ( !didInitializeVideoWriter ) {
cv::Size frameSize = frame.size();
qDebug() << "Initializing Video Recording to save Video file here: " << destinationFileName;
std::string filename = destinationFileName.toStdString();
//int fcc = CV_FOURCC('M','J','P','G');
int fcc = CV_FOURCC('X','2','6','4');
//int fcc = CV_FOURCC('X','V','I','D');
//int fcc = CV_FOURCC('M','P','E','G');
//int fcc = CV_FOURCC('H','2','6','4');
//int fcc = CV_FOURCC('M','P','4','V');
//int fcc = CV_FOURCC('A','V','C','1');
//int fcc = CV_FOURCC('D','I','V','X');
//int fcc = 0x21;
//int fcc = 0x00000021;
int fps = 1;
videoRecorder = new cv::VideoWriter(filename,fcc,fps,frameSize);
qDebug() << "Starting";
frameCounter = 1;
performanceTimer.start();
didInitializeVideoWriter = true;
}
cv::putText(frame,"[REC]",cv::Point(50,50),5,1,cv::Scalar(0,0,225));
QFuture<void> backgroundRun = QtConcurrent::run(this, &Downloader::writeFrame, frame);
//backgroundRun.waitForFinished();
}
reply->deleteLater();
qDebug() << "RequestTimer: " << performanceTimer.elapsed() << frameCounter;
// Requests Again
networkManager->get(QNetworkRequest(QUrl(downloadUrl)));
frameCounter++;
performanceTimer.restart();
}
</void>Update - I tried ’a’,’v’,’c’,’1’ and unfortunately that also does not work :
Initializing Video Recording to save Video file here: "/tmp/Garage.mp4"
[h264_v4l2m2m @ 0x810f6aa0] Could not find a valid device
[h264_v4l2m2m @ 0x810f6aa0] can't configure encoder
Could not open codec 'h264_v4l2m2m': Unspecified error
(qt-downloader:6234): GStreamer-CRITICAL **: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
OpenCV Error: Unspecified error (GStreamer: cannot link elements
) in CvVideoWriter_GStreamer::open, file /media/usb/opencv/modules/videoio/src/cap_gstreamer.cpp, line 1635
VIDEOIO(cvCreateVideoWriter_GStreamer (filename, fourcc, fps, frameSize, is_color)): raised OpenCV exception:
/media/usb/opencv/modules/videoio/src/cap_gstreamer.cpp:1635: error: (-2) GStreamer: cannot link elements
in function CvVideoWriter_GStreamer::openWhen I try the X264 FOURCC, the mp4 file is 48 bytes and never grows :
Initializing Video Recording to save Video file here: "/tmp/Garage.mp4"
OpenCV: FFMPEG: tag 0x34363258/'X264' is not supported with codec id 27 and format 'mp4 / MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x31637661/'avc1'Static Size :
debian@BeagleBoard-X15:/tmp$ ls -lrt Garage.*
-rw-r--r-- 1 debian debian 48 Dec 24 21:13 Garage.mp4
-rw-r--r-- 1 debian debian 100424 Dec 24 21:14 Garage.jpeg
debian@BeagleBoard-X15:/tmp$ hexdump Garage.mp4
0000000 0000 2000 7466 7079 7369 6d6f 0000 0002
0000010 7369 6d6f 7369 326f 7661 3163 706d 3134
0000020 0000 0800 7266 6565 0000 0000 646d 7461
0000030Here is my ffmpeg build conf :
debian@BeagleBoard-X15:/tmp$ ffmpeg -buildconf
ffmpeg version N-89524-g74f408cc8e Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18) 20170516
configuration: --enable-gpl --enable-libx264 --enable-pthreads --enable-static --extra-cflags=-I./x264/include --extra-ldflags=-L./x264/lib --extra-libs=-ldl
libavutil 56. 6.100 / 56. 6.100
libavcodec 58. 8.100 / 58. 8.100
libavformat 58. 3.100 / 58. 3.100
libavdevice 58. 0.100 / 58. 0.100
libavfilter 7. 7.100 / 7. 7.100
libswscale 5. 0.101 / 5. 0.101
libswresample 3. 0.101 / 3. 0.101
libpostproc 55. 0.100 / 55. 0.100
configuration:
--enable-gpl
--enable-libx264
--enable-pthreads
--enable-static
--extra-cflags=-I./x264/include
--extra-ldflags=-L./x264/lib
--extra-libs=-ldl -
Normalize input with equal length streams
16 décembre 2020, par user319862How can I use ffmpeg to take an arbitrary input file and have the output make audio and video streams equal length starting at time 0. The audio padded with silence. And the video repeating the first frame on the beginning and the last frame on the end.


Edited for clarity :


If the video content starts after the sound, I would like to take the first frame and show it from 0 until the video starts.


If the video content stops before the sound, I would like to take the last frame of the video and display it until the audio stops.


If the audio starts after the video, I would like to pad the gap with silence. If the audio stops before the video, I would like to pad the gap with silence.


-
Split the video in 30 second equal parts in android using the Ffmpeg
21 novembre 2019, par corgiwooerI am on a video editing project. In which I want to edit the video into 30 sec equal parts. Right now I am using the RangeSeekBar to get the starting and ending point which works perfectly fine. But now I want to split the video into equal parts but don’t know how to do it. This is what I tried
private void executeCutVideoCommand(int startMs, int endMs) {
File moviesDir = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_MOVIES
);
String filePrefix = "cut_video";
String fileExtn = ".mp4";
String yourRealPath = getPath(VideoCutterActivity.this, selectedVideoUri);
File dest = new File(moviesDir, filePrefix + fileExtn);
int fileNo = 0;
while (dest.exists()) {
fileNo++;
dest = new File(moviesDir, filePrefix + fileNo + fileExtn);
}
filePath = dest.getAbsolutePath();
String[] complexCommand = {"-ss", "" + startMs / 1000, "-y", "-i", yourRealPath, "-t", "" + (endMs - startMs) / 1000,"-vcodec", "mpeg4", "-b:v", "2097152", "-b:a", "48000", "-ac", "2", "-ar", "22050", filePath};
execFFmpegBinary(complexCommand);
MediaScannerConnection.scanFile(VideoCutterActivity.this,
new String[] { filePath },
null,
new MediaScannerConnection.OnScanCompletedListener() {
public void onScanCompleted(String path, Uri uri) {
Log.i("ExternalStorage", "Scanned " + path + ":");
Log.i("ExternalStorage", "-> uri=" + uri);
}
});
}
/**
* Executing ffmpeg binary
*/
private void execFFmpegBinary(final String[] command) {
try {
ffmpeg.execute(command, new ExecuteBinaryResponseHandler() {
@Override
public void onFailure(String s) {
Log.d(TAG, "FAILED with output : " + s);
}
@Override
public void onSuccess(String s) {
Log.d(TAG, "SUCCESS with output : " + s);
Intent intent = new Intent(VideoCutterActivity.this, PreviewActivity.class);
intent.putExtra(FILEPATH, filePath);
startActivity(intent);
}
@Override
public void onProgress(String s) {
progressDialog.setMessage("progress : " + s);
}
@Override
public void onStart() {
progressDialog.setMessage("Processing...");
progressDialog.show();
}
@Override
public void onFinish() {
progressDialog.dismiss();
}
});
} catch (FFmpegCommandAlreadyRunningException e) {
// do nothing for now
}
}The above method takes the starting and the ending point and edits the video.
I also tried to add for loop for this purpose but it didnt workout for me.
cutVideo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
choice = 2;
if (selectedVideoUri != null) {
int start,end;
for (int i=0;i<=duration;i=i+30){
start=i;
end=start+30;
executeCutVideoCommand(start,end);
}
// executeCutVideoCommand(rangeSeekBar.getSelectedMinValue().intValue() * 1000, rangeSeekBar.getSelectedMaxValue().intValue() * 1000);
} else
Snackbar.make(mainlayout, "Please upload a video", 4000).show();
}
});Please can anyone tell me how to do it. Help is much appreciated