
Recherche avancée
Autres articles (15)
-
Personnaliser les catégories
21 juin 2013, parFormulaire de création d’une catégorie
Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
On peut modifier ce formulaire dans la partie :
Administration > Configuration des masques de formulaire.
Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...) -
Les formats acceptés
28 janvier 2010, parLes commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
ffmpeg -codecs ffmpeg -formats
Les format videos acceptés en entrée
Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
Les formats vidéos de sortie possibles
Dans un premier temps on (...) -
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 (4872)
-
Bad quality output with FFmpeg, bitrate specified [closed]
28 septembre 2012, par Darkman2412I have a static background image where I add 2 videos on top of it using FFmpeg CLI. The output file (
test.avi
in this case), is very bad quality.ffmpeg -loop 1 -i outro.png
-vf "movie='intro.mov' [last], [last]scale=512:288[scaled1], [in][scaled1] overlay=290:396 [tmp];
movie='intro2.mov' [featured], [featured]scale=512:288[scaled2], [tmp][scaled2] overlay=1118:396 [out]" -b 512k -t 10 -r 30 -y test.aviThe first image is the first frame of
test.avi
.
The second one is what it should be.Edit : my question is why it's such bad quality.
Edit2 : Console output :
ffmpeg version N-44601-gcb3591e Copyright (c) 2000-2012 the FFmpeg developers
built on Sep 19 2012 16:31:43 with gcc 4.7.1 (GCC)
configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 51. 73.101 / 51. 73.101
libavcodec 54. 56.100 / 54. 56.100
libavformat 54. 27.101 / 54. 27.101
libavdevice 54. 2.100 / 54. 2.100
libavfilter 3. 16.104 / 3. 16.104
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
[image2 @ 0000000001f4fa40] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, image2, from 'outro.png':
Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgba64be, 1920x1080, 25 tbr, 25 tbn, 25 tbc
Please use -q:a or -q:v, -qscale is ambiguous
Output #0, avi, to 'test.avi':
Metadata:
ISFT : Lavf54.27.101
Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1920x1080, q=2-31, 200 kb/s, 30 tbn, 30 tbc
Stream mapping:
Stream #0:0 -> #0:0 (png -> mpeg4)
Press [q] to stop, [?] for help
frame= 6 fps=0.0 q=2.0 size= 72kB time=00:00:00.23 bitrate=2527.9kbits/s
frame= 12 fps= 11 q=2.0 size= 115kB time=00:00:00.46 bitrate=2013.6kbits/s
frame= 18 fps= 11 q=2.0 size= 190kB time=00:00:00.70 bitrate=2223.8kbits/s
frame= 24 fps= 11 q=2.0 size= 235kB time=00:00:00.96 bitrate=1987.4kbits/s
frame= 30 fps= 11 q=2.0 size= 314kB time=00:00:01.20 bitrate=2142.8kbits/s
frame= 36 fps= 11 q=2.0 size= 368kB time=00:00:01.43 bitrate=2102.2kbits/s
frame= 42 fps= 11 q=2.0 size= 457kB time=00:00:01.66 bitrate=2247.6kbits/s
frame= 48 fps= 11 q=2.0 size= 510kB time=00:00:01.90 bitrate=2199.8kbits/s
frame= 54 fps= 11 q=2.0 size= 596kB time=00:00:02.16 bitrate=2253.9kbits/s
frame= 60 fps= 11 q=2.0 size= 649kB time=00:00:02.40 bitrate=2216.5kbits/s
frame= 66 fps= 11 q=2.0 size= 718kB time=00:00:02.63 bitrate=2232.9kbits/s
frame= 72 fps= 11 q=2.0 size= 779kB time=00:00:02.86 bitrate=2226.4kbits/s
frame= 78 fps= 11 q=2.0 size= 868kB time=00:00:03.10 bitrate=2293.0kbits/s
frame= 84 fps= 11 q=2.0 size= 956kB time=00:00:03.36 bitrate=2325.8kbits/s
frame= 90 fps= 11 q=2.0 size= 1049kB time=00:00:03.60 bitrate=2386.2kbits/s
frame= 96 fps= 11 q=2.0 size= 1143kB time=00:00:03.83 bitrate=2442.9kbits/s
frame= 101 fps= 11 q=2.0 size= 1224kB time=00:00:04.03 bitrate=2485.2kbits/s
frame= 106 fps= 10 q=2.0 size= 1259kB time=00:00:04.23 bitrate=2436.7kbits/s
frame= 111 fps= 10 q=2.0 size= 1326kB time=00:00:04.43 bitrate=2449.5kbits/s
frame= 116 fps= 10 q=2.0 size= 1355kB time=00:00:04.63 bitrate=2396.5kbits/s
frame= 121 fps= 10 q=2.0 size= 1409kB time=00:00:04.83 bitrate=2388.1kbits/s
frame= 127 fps= 10 q=2.0 size= 1424kB time=00:00:05.06 bitrate=2302.5kbits/s
frame= 133 fps= 10 q=2.0 size= 1480kB time=00:00:05.30 bitrate=2286.8kbits/s
frame= 139 fps= 10 q=2.0 size= 1497kB time=00:00:05.56 bitrate=2203.7kbits/s
frame= 145 fps= 10 q=2.0 size= 1552kB time=00:00:05.80 bitrate=2191.8kbits/s
frame= 151 fps= 10 q=2.0 size= 1567kB time=00:00:06.03 bitrate=2127.6kbits/s
frame= 157 fps= 10 q=2.0 size= 1621kB time=00:00:06.26 bitrate=2119.2kbits/s
frame= 163 fps= 10 q=2.0 size= 1641kB time=00:00:06.50 bitrate=2068.1kbits/s
frame= 169 fps= 10 q=2.0 size= 1710kB time=00:00:06.76 bitrate=2070.3kbits/s
frame= 175 fps= 10 q=2.0 size= 1750kB time=00:00:07.00 bitrate=2047.9kbits/s
frame= 181 fps= 10 q=2.0 size= 1834kB time=00:00:07.23 bitrate=2077.6kbits/s
frame= 187 fps= 10 q=2.0 size= 1876kB time=00:00:07.46 bitrate=2058.4kbits/s
frame= 193 fps= 10 q=2.0 size= 1962kB time=00:00:07.70 bitrate=2087.7kbits/s
frame= 199 fps= 10 q=2.0 size= 2005kB time=00:00:07.96 bitrate=2061.5kbits/s
frame= 205 fps= 10 q=2.0 size= 2088kB time=00:00:08.20 bitrate=2086.1kbits/s
frame= 211 fps= 10 q=2.0 size= 2126kB time=00:00:08.43 bitrate=2065.0kbits/s
frame= 217 fps= 10 q=2.0 size= 2201kB time=00:00:08.66 bitrate=2080.5kbits/s
frame= 223 fps= 10 q=2.0 size= 2230kB time=00:00:08.90 bitrate=2052.8kbits/s
frame= 229 fps= 10 q=2.0 size= 2293kB time=00:00:09.16 bitrate=2049.5kbits/s
frame= 235 fps= 10 q=2.0 size= 2307kB time=00:00:09.40 bitrate=2010.4kbits/s
frame= 241 fps= 10 q=2.0 size= 2366kB time=00:00:09.63 bitrate=2011.8kbits/s
frame= 247 fps= 10 q=2.0 size= 2409kB time=00:00:09.86 bitrate=2000.1kbits/s
frame= 250 fps= 10 q=2.0 Lsize= 2438kB time=00:00:10.00 bitrate=1997.2kbits/s
video:2425kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.523809% -
Creating a shared library that statically includes ffmpeg
10 octobre 2017, par El SampsaI’m having hard time trying to create a shared library that has ffmpeg libraries "baked in" as static ones.
Consider the following directory schema :
include/
my own .h files
ext/
ffmpeg .h files
lib/
libav*.a archive files (softlinks to the actual .a files)
libValkka.so (my shared library)
test/
mytest.cpp
bin/
(binaries appear here)I’ve come a long way (see Including objects to a shared library from a C++ archive (.a) ) and the library compiles ok with this : ([STUFF] has been omitted for brevity)
/usr/bin/c++ -fPIC -std=c++14 -pthread -Iinclude/ext -I/usr/include/libdrm -g -shared -Wl,-soname,libValkka.so -o lib/libValkka.so CMakeFiles/Valkka.dir/src/avthread.cpp.o CMakeFiles/Valkka.dir/src/opengl.cpp.o CMakeFiles/Valkka.dir/src/openglthread.cpp.o [STUFF] CMakeFiles/Valkka.dir/src/filters.cpp.o -lX11 -lGLEW -lGLU -lGL -Wl,—allow-multiple-definition -Wl,-Bsymbolic -Wl,—whole-archive -Wreorder lib/libavdevice.a lib/libavfilter.a lib/libavformat.a lib/libavcodec.a lib/libavutil.a lib/libswscale.a lib/libswresample.a -Wl,—no-whole-archive
However, when creating executables - their source code does not use any ffmpeg api (just my own api) - with :
c++ -std=c++14 -pthread -Iinclude -Iinclude/ext -Llib test/mytest.cpp -lValkka -g -o bin/mytest
I get a hoard of errors about missing ffmpeg dependencies. Not everything is missing, just some weird stuff :
lib/libValkka.so: undefined reference to `pa_stream_get_index'
lib/libValkka.so: undefined reference to `deflateInit_'
lib/libValkka.so: undefined reference to `pa_stream_get_state'
lib/libValkka.so: undefined reference to `lzma_stream_decoder'
lib/libValkka.so: undefined reference to `BZ2_bzDecompress'
lib/libValkka.so: undefined reference to `vaInitialize'
lib/libValkka.so: undefined reference to `pa_stream_unref'
lib/libValkka.so: undefined reference to `deflateInit2_'
lib/libValkka.so: undefined reference to `snd_pcm_close'
...
lib/libValkka.so: undefined reference to `vaGetDisplayDRM'
lib/libValkka.so: undefined reference to `vaMaxNumEntrypoints'
lib/libValkka.so: undefined reference to `uncompress'
lib/libValkka.so: undefined reference to `pa_stream_drop'
lib/libValkka.so: undefined reference to `pa_context_connect'
lib/libValkka.so: undefined reference to `FT_Get_Kerning'
lib/libValkka.so: undefined reference to `ass_free_track'
lib/libValkka.so: undefined reference to `pa_operation_unref'
lib/libValkka.so: undefined reference to `FT_Stroker_Done'
lib/libValkka.so: undefined reference to `vaTerminate'
lib/libValkka.so: undefined reference to `ass_new_track'
lib/libValkka.so: undefined reference to `jack_client_close'
...
lib/libValkka.so: undefined reference to `xcb_xfixes_query_version'
lib/libValkka.so: undefined reference to `xcb_shape_rectangles'
lib/libValkka.so: undefined reference to `pa_mainloop_free'
lib/libValkka.so: undefined reference to `snd_device_name_hint'
lib/libValkka.so: undefined reference to `vaCreateImage'
lib/libValkka.so: undefined reference to `vaBeginPicture'
lib/libValkka.so: undefined reference to `DtsSetColorSpace'
lib/libValkka.so: undefined reference to `vaDestroyConfig'
lib/libValkka.so: undefined reference to `pa_stream_writable_size'
lib/libValkka.so: undefined reference to `snd_pcm_hw_params_get_buffer_size_max'
lib/libValkka.so: undefined reference to `ass_read_file'This is pretty frustrating, especially when I can see that those names are included in the shared library..!
nm lib/libValkka.so | grep "vaBeginPicture"
gives
U vaBeginPicture
etc. I thought it might be a problem regarding the dependency order the archive .a files, and also tried with :
..... -Wl,—allow-multiple-definition -Wl,-Bsymbolic -Wl,—start-group -Wl,—whole-archive -Wreorder lib/libavdevice.a lib/libavfilter.a lib/libavformat.a lib/libavcodec.a lib/libavutil.a lib/libswscale.a lib/libswresample.a -Wl,—no-whole-archive -Wl,—end-group
But the problem persists.
I have succesfully created a shared library that does not "bake in" those .a archives, i.e. that just depends dynamically on ffmpeg libraries, and there are no such problems.
I am baffled.. Have I misunderstood something fundamental, forgot some annoying linked option, or both ? Help appreciated !
-
FFMPEG passthrough recording RTSP/H264 to MP4 container bad encoding
16 janvier 2019, par Cédric VerstraetenHello I’m using the ffmpeg 3.4.2 to record a RTSP h264 steam from an IP camera. I have a working example however at the beginning I see some corrupted images, after a couple of seconds the video is shown properly. I was wondering if this is a timing issue.
The source code which illustrates opening and reading a RTSP stream, and writing it into an MP4 container.
#include
#include
#include
#include <iostream>
#include <fstream>
#include <sstream>
#include <sys></sys>time.h>
extern "C" {
#include <libavcodec></libavcodec>avcodec.h>
#include <libavutil></libavutil>opt.h>
#include <libavutil></libavutil>imgutils.h>
#include <libavformat></libavformat>avformat.h>
#include <libavformat></libavformat>avio.h>
#include <libswscale></libswscale>swscale.h>
}
time_t get_time()
{
struct timeval tv;
gettimeofday( &tv, NULL );
return tv.tv_sec;
}
int main(int argc, char **argv)
{
const char *filename, *codec_name;
const AVCodec *codec;
AVCodecContext *c= NULL;
int i, ret, x, y;
// Open the initial context variables that are needed
AVFormatContext* format_ctx = avformat_alloc_context();
int video_stream_index;
// Register everything
av_register_all();
avformat_network_init();
//open RTSP
AVDictionary *ifmtdict;
av_dict_set(&ifmtdict, "rtsp_transport", "tcp", 0);
if (avformat_open_input(&format_ctx, "rtsp://192.168.0.84/user=admin_password=_channel=1_stream=0.sdp",
NULL, &ifmtdict) != 0) {
return EXIT_FAILURE;
}
if (avformat_find_stream_info(format_ctx, NULL) < 0) {
return EXIT_FAILURE;
}
//search video stream
for (int i = 0; i < format_ctx->nb_streams; i++) {
if (format_ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO)
video_stream_index = i;
}
AVPacket packet;
av_init_packet(&packet);
AVStream* stream = NULL;
int cnt = 0;
//start reading packets from stream and write them to file
av_read_play(format_ctx); //play RTSP
// Get the codec
codec = avcodec_find_decoder(AV_CODEC_ID_H264);
if (!codec) {
exit(1);
}
// Prepare the output
AVFormatContext* oc = avformat_alloc_context();
oc->oformat = av_guess_format(NULL, "video.mp4", NULL);
avio_open2(&oc->pb, "video.mp4", AVIO_FLAG_WRITE, NULL, NULL);
// Write header
stream = avformat_new_stream(oc, (AVCodec*) format_ctx->streams[video_stream_index]->codec->codec);
avcodec_parameters_copy(stream->codecpar, format_ctx->streams[video_stream_index]->codecpar);
stream->sample_aspect_ratio = format_ctx->streams[video_stream_index]->codec->sample_aspect_ratio;
stream->codecpar->codec_tag = 0;
stream->time_base = format_ctx->streams[video_stream_index]->time_base;
avformat_write_header(oc, NULL);
time_t timenow, timestart;
timestart = timenow = get_time();
bool got_key_frame = 0;
while (av_read_frame(format_ctx, &packet) >= 0 && cnt < 200000) { //read ~ 200000 frames
if (packet.stream_index == video_stream_index) { //packet is video
// Make sure we start on a key frame
if ( !got_key_frame && timestart == timenow && ! ( packet.flags & AV_PKT_FLAG_KEY ) ) {
timestart = timenow = get_time();
continue;
}
got_key_frame = 1;
std::cout << cnt << std::endl;
av_interleaved_write_frame( oc, &packet );
cnt++;
}
av_free_packet(&packet);
av_init_packet(&packet);
timenow = get_time();
}
av_write_trailer(oc);
avcodec_close(stream->codec);
avio_close(oc->pb);
avformat_free_context(oc);
av_read_pause(format_ctx);
avcodec_free_context(&c);
avformat_network_deinit();
return 0;
}
</sstream></fstream></iostream>