
Recherche avancée
Médias (3)
-
Elephants Dream - Cover of the soundtrack
17 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Image
-
Valkaama DVD Label
4 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Image
-
Publier une image simplement
13 avril 2011, par ,
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (87)
-
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 -
De l’upload à la vidéo finale [version standalone]
31 janvier 2010, parLe chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
Upload et récupération d’informations de la vidéo source
Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...) -
Librairies et binaires spécifiques au traitement vidéo et sonore
31 janvier 2010, parLes logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
Binaires complémentaires et facultatifs flvtool2 : (...)
Sur d’autres sites (8366)
-
How to use FFMPEG commands
26 septembre 2013, par Shashank AgarwalIn android i am making an app in which it will record an video and crop the video from center for doing so i found FFMPEG over google. I followed http://dmitrydzz-hobby.blogspot.in/2012/04/how-to-build-ffmpeg-and-use-it-in.html
It works fine but i want to know how to use this `ffmpeg -y -i /sdcard/videokit/short.mp4 -vf crop=100:100:0:0 -s 320x240 -r 15 -aspect 3:4 -ab 12288 -vcodec mpeg4 -b 2097152 -sample_fmt s16 /sdcard/videokit/out.mp4
` video cropping command and Where to write this command.
I have tried this (for concatenation just to check about how to use ffmpeg command )
public class MainActivity extends Activity {
private static native int logFileInfo(String[] args);
String pathOut = "/storage/sdcard/12.mp3";
String pathInM = "/storage/sdcard/23.mp3";
String pathIn = "/storage/sdcard/out.mp3";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String[] args = {"ffmpeg", "-i", "concat:", pathOut, "|",pathInM ,pathIn};
logFileInfo(args);
//logFileInfo("/storage/sdcard/12.mp3");
}
static
{
System.loadLibrary("mylib");
}But i dont know what to write in mylib.c to execute this.somebody Please help
-
FFmpeg auto rotate video when copying video stream without re-encoding
25 février 2019, par Mahfujur RahmanI have been trying to convert an mp4 (portrait) file to mkv. As the mkv container support any video and audio stream, I am copying the audio and video stream to the output container. The command I’m using
ffmpeg -y -i test.mp4 -vcodec copy -acodec copy test.mkv
File info for
test.mp4
is followingInput #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2019-02-23T11:18:50.000000Z
com.android.version: 8.0.0
Duration: 00:00:25.86, start: 0.000000, bitrate: 12270 kb/s
Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 12005 kb/s, SAR 1:1 DAR 16:9, 30 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
rotate : 90
creation_time : 2019-02-23T11:18:50.000000Z
handler_name : VideoHandle
Side data:
displaymatrix: rotation of -90.00 degrees
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
Metadata:
creation_time : 2019-02-23T11:18:50.000000Z
handler_name : SoundHandleNow, the problem is that the output video I get from ffmpeg is a 90 degree counter clockwise rotated video. The reason I believe is the following info being removed from output file,
Side data:
displaymatrix: rotation of -90.00 degreesFile info for rotated output file
test.mkv
Input #0, matroska,webm, from 'test.mkv':
Metadata:
MAJOR_BRAND : mp42
MINOR_VERSION : 0
COMPATIBLE_BRANDS: isommp42
COM.ANDROID.VERSION: 8.0.0
ENCODER : Lavf58.12.100
Duration: 00:00:25.87, start: 0.000000, bitrate: 12265 kb/s
Stream #0:0(eng): Video: h264, yuv420p(tv, bt709, progressive), 1280x720, SAR 1:1 DAR 16:9, 30 fps, 30 tbr, 1k tbn, 2k tbc (default)
Metadata:
ROTATE : 90
HANDLER_NAME : VideoHandle
DURATION : 00:00:25.866000000
Stream #0:1(eng): Audio: aac, 48000 Hz, stereo, fltp (default)
Metadata:
HANDLER_NAME : SoundHandle
DURATION : 00:00:25.813000000But when I convert this rotated output
test.mkv
to mp4 again, I get the portrait file. The displaymatrix side data appears again in the file info.Converting the same mp4 file to m4v by copying the steam works fine.
So, this whole thing is very much confusing to me.
Now my question is, how can I convert the mp4 file to mkv without re-encoding and avoid getting rotated output ?
In this post they solved it for c++. I am working on android and using ffmpeg android wrapper to use the ffmpeg library. Is there any ffmpeg flag to handle this situation ?
-
How do I extract the first frame of a video stream as an image using avcpp ?
19 mars 2023, par AurelaNYTI'm trying to extract the first frame of a video stream and save it as an image using the avcpp library (https://github.com/h4tr3d/avcpp). I have already written some code but I'm not sure how to extract the first frame from the stream and save it to a .JPG file. Can someone help me with this ?


I have done the following for now and it works fine, however I am unable to understand how to go on with the conversion of the frame to an image :


#include "iostream"
#include "avcpp/av.h"
#include "avcpp/codec.h"
#include "avcpp/frame.h"
#include "avcpp/packet.h"
#include "avcpp/codeccontext.h"
#include "avcpp/formatcontext.h"

class OpenVHCR {
public:

 static void getFirstFrame(const std::string& stream_uri, const bool debug_log) {
 av::init();
 av::Codec videoCodec;
 av::Stream videoStream;
 size_t videoStreamID = -1;
 std::error_code errorCode;
 av::FormatContext formatContext;
 av::VideoDecoderContext decoderContext;
 formatContext.openInput(stream_uri);
 if(formatContext.streamsCount() < 1){
 std::cerr << "[I/O] Failed to find a video steam in the URI provided." << std::endl;
 }else{
 if(debug_log){
 std::cout << "[I/O] Successfully found " << formatContext.streamsCount() << " streams in the URI provided." << std::endl;
 }
 formatContext.findStreamInfo(errorCode);
 if (errorCode) {
 std::cerr << "[AV] An unexpected error has occurred: " << errorCode.message() << std::endl;
 return;
 }
 for (size_t i = 0; i < formatContext.streamsCount(); ++i) {
 auto st = formatContext.stream(i);
 if (st.mediaType() == AVMEDIA_TYPE_VIDEO) {
 videoStreamID = i;
 videoStream = st;
 break;
 }
 }
 if(!videoStream.isNull() && videoStream.isValid()){
 if(debug_log){
 std::cout << "[I/O] Successfully opened a valid video stream." << std::endl;
 }
 decoderContext = av::VideoDecoderContext(videoStream);
 videoCodec = av::findDecodingCodec(decoderContext.raw()->codec_id);
 decoderContext.setCodec(videoCodec);
 decoderContext.setRefCountedFrames(true);
 decoderContext.open({{"threads", "1"}}, av::Codec(), errorCode);
 if(errorCode){
 std::cout << "[AV] Failed to find a supported codec for the stream." << std::endl;
 return;
 }else{
 while (av::Packet streamPacket = formatContext.readPacket(errorCode)){
 if(errorCode){
 std::cout << "[AV] Failed to read a packet from the stream." << std::endl;
 return;
 }else{
 std::cout << "[AV] Successfully read a packet from the stream." << std::endl;
 if(streamPacket.streamIndex() != videoStreamID){
 continue;
 }
 //TODO: Find a way to get the first frame from the stream and save it as an image.
 av::VideoFrame videoFrame = decoderContext.decode(streamPacket, errorCode);
 std::cout << "[AV] Successfully received a frame from the video." << std::endl;
 if (errorCode) {
 std::cerr << "[AV] An unexpected error has occurred: " << errorCode.message() << std::endl;
 return;
 } else if (!videoFrame) {
 std::cerr << "[AV] The received video frame seems to be empty." << std::endl;
 }
 }
 }

 formatContext.close();
 decoderContext.close();
 }
 }else{
 std::cerr << "[I/O] Failed to find open a valid video stream." << std::endl;
 }
 }
 }
};