
Recherche avancée
Médias (91)
-
Spitfire Parade - Crisis
15 mai 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Wired NextMusic
14 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
-
Video d’abeille en portrait
14 mai 2011, par
Mis à jour : Février 2012
Langue : français
Type : Video
-
Sintel MP4 Surround 5.1 Full
13 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
-
Carte de Schillerkiez
13 mai 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
-
Publier une image simplement
13 avril 2011, par ,
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (86)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...) -
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 ;
Sur d’autres sites (12016)
-
Issue in recording video
16 novembre 2015, par human123I am trying to record video in 480*480 resolution like in vine using javacv. As a starting point I used the sample provided in https://github.com/bytedeco/javacv/blob/master/samples/RecordActivity.java Video is getting recorded (but not in the desired resolution) and saved.
But the issue is that 480*480 resolution is not supported natively in android. So some pre processing needs to be done to get the video in desired resolution.
So once I was able to record video using code sample provided by javacv, next challenge was on how to pre process the video. On research it was found that efficient cropping is possible when final image width required is same as recorded image width. Such a solution was provided in the SO question,Recording video on Android using JavaCV (Updated 2014 02 17). I changed onPreviewFrame method as suggested in that answer.
@Override
public void onPreviewFrame(byte[] data, Camera camera) {
if (audioRecord == null || audioRecord.getRecordingState() != AudioRecord.RECORDSTATE_RECORDING) {
startTime = System.currentTimeMillis();
return;
}
if (RECORD_LENGTH > 0) {
int i = imagesIndex++ % images.length;
yuvImage = images[i];
timestamps[i] = 1000 * (System.currentTimeMillis() - startTime);
}
/* get video data */
imageWidth = 640;
imageHeight = 480
int finalImageHeight = 360;
if (yuvImage != null && recording) {
ByteBuffer bb = (ByteBuffer)yuvImage.image[0].position(0); // resets the buffer
final int startY = imageWidth*(imageHeight-finalImageHeight)/2;
final int lenY = imageWidth*finalImageHeight;
bb.put(data, startY, lenY);
final int startVU = imageWidth*imageHeight + imageWidth*(imageHeight-finalImageHeight)/4;
final int lenVU = imageWidth* finalImageHeight/2;
bb.put(data, startVU, lenVU);
try {
long t = 1000 * (System.currentTimeMillis() - startTime);
if (t > recorder.getTimestamp()) {
recorder.setTimestamp(t);
}
recorder.record(yuvImage);
} catch (FFmpegFrameRecorder.Exception e) {
Log.e(LOG_TAG, "problem with recorder():", e);
}
}
}
}Please also note that this solution was provided for an older version of javacv. The resulting video had a yellowish overlay covering 2/3rd part. Also there was empty section on left side as the video was not cropped correctly.
So my question is what is the most appropriate solution for cropping videos using latest version of javacv ?
Code after making change as suggested by Alex Cohn
@Override
public void onPreviewFrame(byte[] data, Camera camera) {
if (audioRecord == null || audioRecord.getRecordingState() != AudioRecord.RECORDSTATE_RECORDING) {
startTime = System.currentTimeMillis();
return;
}
if (RECORD_LENGTH > 0) {
int i = imagesIndex++ % images.length;
yuvImage = images[i];
timestamps[i] = 1000 * (System.currentTimeMillis() - startTime);
}
/* get video data */
imageWidth = 640;
imageHeight = 480;
destWidth = 480;
if (yuvImage != null && recording) {
ByteBuffer bb = (ByteBuffer)yuvImage.image[0].position(0); // resets the buffer
int start = 2*((imageWidth-destWidth)/4); // this must be even
for (int row=0; row2; row++) {
bb.put(data, start, destWidth);
start += imageWidth;
}
try {
long t = 1000 * (System.currentTimeMillis() - startTime);
if (t > recorder.getTimestamp()) {
recorder.setTimestamp(t);
}
recorder.record(yuvImage);
} catch (FFmpegFrameRecorder.Exception e) {
Log.e(LOG_TAG, "problem with recorder():", e);
}
}
}Screen shot from video generated with this code (destWidth 480) is
Next I tried capturing a video with destWidth speciified as 639. The result is
When destWidth is 639 video is repeating contents twice. When it is 480, contents are repeated 5 times and the green overlay and distortion is more.
Also When the destWidth = imageWidth, video is captured properly. ie, for 640*480 there is no repetition of video contents and no green overlay.
Converting frame to IplImage
When this question was asked first, I missed to mention that the record method in FFmpegFrameRecorder is now accepting object of type Frame whereas earlier it was IplImage object. So I tried to apply Alex Cohn’s solution by converting Frame to IplImage.
//---------------------------------------
// initialize ffmpeg_recorder
//---------------------------------------
private void initRecorder() {
Log.w(LOG_TAG,"init recorder");
imageWidth = 640;
imageHeight = 480;
if (RECORD_LENGTH > 0) {
imagesIndex = 0;
images = new Frame[RECORD_LENGTH * frameRate];
timestamps = new long[images.length];
for (int i = 0; i < images.length; i++) {
images[i] = new Frame(imageWidth, imageHeight, Frame.DEPTH_UBYTE, 2);
timestamps[i] = -1;
}
} else if (yuvImage == null) {
yuvImage = new Frame(imageWidth, imageHeight, Frame.DEPTH_UBYTE, 2);
Log.i(LOG_TAG, "create yuvImage");
OpenCVFrameConverter.ToIplImage converter = new OpenCVFrameConverter.ToIplImage();
yuvIplimage = converter.convert(yuvImage);
}
Log.i(LOG_TAG, "ffmpeg_url: " + ffmpeg_link);
recorder = new FFmpegFrameRecorder(ffmpeg_link, imageWidth, imageHeight, 1);
recorder.setFormat("flv");
recorder.setSampleRate(sampleAudioRateInHz);
// Set in the surface changed method
recorder.setFrameRate(frameRate);
Log.i(LOG_TAG, "recorder initialize success");
audioRecordRunnable = new AudioRecordRunnable();
audioThread = new Thread(audioRecordRunnable);
runAudioThread = true;
}
@Override
public void onPreviewFrame(byte[] data, Camera camera) {
if (audioRecord == null || audioRecord.getRecordingState() != AudioRecord.RECORDSTATE_RECORDING) {
startTime = System.currentTimeMillis();
return;
}
if (RECORD_LENGTH > 0) {
int i = imagesIndex++ % images.length;
yuvImage = images[i];
timestamps[i] = 1000 * (System.currentTimeMillis() - startTime);
}
/* get video data */
int destWidth = 640;
if (yuvIplimage != null && recording) {
ByteBuffer bb = yuvIplimage.getByteBuffer(); // resets the buffer
int start = 2*((imageWidth-destWidth)/4); // this must be even
for (int row=0; row2; row++) {
bb.put(data, start, destWidth);
start += imageWidth;
}
try {
long t = 1000 * (System.currentTimeMillis() - startTime);
if (t > recorder.getTimestamp()) {
recorder.setTimestamp(t);
}
recorder.record(yuvImage);
} catch (FFmpegFrameRecorder.Exception e) {
Log.e(LOG_TAG, "problem with recorder():", e);
}
}
}But the videos generated with this method contained only green frames.
-
How to encode jpeg images to H264 very fast (transform images to video)
17 juillet 2013, par PaulI have 30 JPEG images (.jpg) at a resolution of 480 x 640.
Each image takes aboout 20KB (all of them takes about 600KB).I am using FFmpeg command to encode these images into a video in H264 format.
I need this to be done very fast - about 1 second.
Using the classic command :
ffmpeg -y -f image2 -r 1/5 -i image_%d.jpg -c:v libx264 -r 30 video.mp4
takes about 90 seconds.
After adding
-preset ultrafast
:ffmpeg -y -f image2 -r 1/5 -i image_%d.jpg -c:v libx264 -preset ultrafast -r 30 video.mp4
the encoding takes about 15 seconds which is much better, but still not enough
I've tried others parameters also, like :
-profile:v baseline
-qscale:v
-b:v 1000k
-crf 24but the encoding time does not fall below 10 seconds.
I'm not familiar with FFmpeg commands nor with the parameters I need to use, and this is the reason I post here this question.
The video quality needs to be ok, doesn't need to be perfect.
As a note : I am running these commands in an Android application where I have the ffmpeg executable, using an ProcessBuilder.
Reply1 (to Robert Rowntree) :
ArrayList<string> l2 = new ArrayList<string>();
//l2.add("ffmpeg");
l2.add("/data/data/" + packageName + "/ffmpeg");
l2.add("-y");
l2.add("-loop");
l2.add("1");
l2.add("-i");
l2.add("frame_%d.jpg");
// l2.add("-t");
// l2.add(strngs[3]);
l2.add("-r");
l2.add("1/2");
l2.add("-preset");
l2.add("superfast");
l2.add("-tune");
l2.add("zerolatency");
// l2.add("-pass");
// l2.add(Integer.valueOf(pass).toString());
l2.add("-vcodec");
l2.add("libx264");
l2.add("-b:v");
l2.add("200k");
l2.add("-bt");
l2.add("50k");
l2.add("-threads");
l2.add("0");
l2.add("-b_strategy");
l2.add("1");
// if(pass ==1){
// l2.add("-an");
// } else {
// l2.add("-acodec");
// l2.add("copy");
// }
l2.add("-f");
l2.add("mp4");
l2.add("-strict");
l2.add("-2");
// l2.add("-passlogfile");
// l2.add(strngs[4]);
// if(pass ==1){
// l2.add("/dev/null");
// } else {
// l2.add(strngs[5]);
// }
l2.add("video.mp4");
//return l2;
</string></string> -
Live downscaling of video to memory
4 juin 2013, par Paul KnopfI have some very large videos in 1080p with high bitrates. Needless to say, streaming these files (using HTTP partial content streaming) will require a great deal of buffering on the client.
I need a way to compress/download/de-grade the quality on demand, starting from a certain byte (for range requests). I know I can use FFMpeg to shrink the video for low-resolution playback, but I can't wait for the entire video to be done downscaling before the client can playback. I need to downscale to an in-memory buffer so that I can output straight to the HTTP requests.
How would I do this ? Any libraries out there ? Is this even possible ?
Note : I am using c#/.net, however, I could use some c++/c libraries if any are available and marshal them into c#/.net.