
Recherche avancée
Autres articles (53)
-
MediaSPIP v0.2
21 juin 2013, parMediaSPIP 0.2 est la première version de MediaSPIP stable.
Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...) -
MediaSPIP version 0.1 Beta
16 avril 2011, parMediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...) -
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs
Sur d’autres sites (11021)
-
How to remove black bars with ffmpeg ?
3 novembre 2022, par watch-thisI'm trying to remove black bars from a 637×478 video




here's what happens :


% ffmpeg -i sfu11.mp4 -vf "scale=ih*16/9:ih,scale=iw:-2,setsar=1" -y out.mp4 
ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers
 built with Apple clang version 14.0.0 (clang-1400.0.29.102)
 configuration: --prefix=/usr/local/Cellar/ffmpeg/5.1.2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
 libavutil 57. 28.100 / 57. 28.100
 libavcodec 59. 37.100 / 59. 37.100
 libavformat 59. 27.100 / 59. 27.100
 libavdevice 59. 7.100 / 59. 7.100
 libavfilter 8. 44.100 / 8. 44.100
 libswscale 6. 7.100 / 6. 7.100
 libswresample 4. 7.100 / 4. 7.100
 libpostproc 56. 6.100 / 56. 6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sfu11.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2mp41
 encoder : Lavf57.83.100
 Duration: 01:02:49.37, start: 0.000000, bitrate: 15 kb/s
 Chapters:
 Chapter #0:0: start 0.000000, end 99.833000
 Metadata:
 title : Chapter 01
 Chapter #0:1: start 99.833000, end 701.818000
 Metadata:
 title : Chapter 02
 Chapter #0:2: start 701.818000, end 1213.746000
 Metadata:
 title : Chapter 03
 Chapter #0:3: start 1213.746000, end 1726.892000
 Metadata:
 title : Chapter 04
 Chapter #0:4: start 1726.892000, end 2167.882000
 Metadata:
 title : Chapter 05
 Chapter #0:5: start 2167.882000, end 2816.430000
 Metadata:
 title : Chapter 06
 Chapter #0:6: start 2816.430000, end 3769.366000
 Metadata:
 title : Chapter 07
 Stream #0:0[0x1](und): Video: hevc (Main 10) (hvc1 / 0x31637668), yuv420p10le(tv, progressive), 708x478 [SAR 9:10 DAR 1593:1195], 544 kb/s, 23.98 fps, 23.98 tbr, 24k tbn (default)
 Metadata:
 handler_name : VideoHandler
 vendor_id : [0][0][0][0]
 Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 341 kb/s (default)
 Metadata:
 handler_name : SoundHandler
 vendor_id : [0][0][0][0]
 Stream #0:2[0x3](eng): Data: bin_data (text / 0x74786574)
 Metadata:
 handler_name : SubtitleHandler
Stream mapping:
 Stream #0:0 -> #0:0 (hevc (native) -> h264 (libx264))
 Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x7f8630806e00] width not divisible by 2 (849x478)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
[aac @ 0x7f8630809d00] Qavg: 15927.165
[aac @ 0x7f8630809d00] 2 frames left in the queue on closing
Conversion failed!



However, the same flags work using
ffplay
but I get horizontal black bars instead.

% ffplay -i sfu11.mp4 -vf "scale=ih\*16/9:ih,scale=iw:-2,setsar=1"





I also tried using the cropdetect filter. It doesn't work and end up with the very same black bars while passing
-vf crop=...
.

-
avutil/eval : Use even better PRNG
2 janvier 2024, par Michael Niedermayeravutil/eval : Use even better PRNG
This is the 64bit version of Chris Doty-Humphreys SFC64
Compared to the LCGs these produce much better quality numbers.
Compared to LFGs this needs less state. (our LFG has 224 byte
state for its 32bit version) this has 32byte state
Also the initialization for our LFG is slower.
This is also much faster than KISS or PCG.This commit replaces the broken LCG used before.
(broken as it had only a period 200M due to being put in a double)This changes the output from random() which is why libswresample.mak
is updated, update was done using the command in libswresample.makSigned-off-by : Michael Niedermayer <michael@niedermayer.cc>
-
Save RTSP to mp4 with ffmpeg/libav ? Video is not of the right length, possibly too fast ?
20 décembre 2022, par David Bensoussaninspired by other stackoverflow answers, I wrote a code to get an rtps stream into an mp4 file. I tried commenting as much as possible :


#include 
#include 
#include <libavcodec></libavcodec>avcodec.h>
#include <libavformat></libavformat>avformat.h>
#include <libavformat></libavformat>avio.h>
#include <sys></sys>time.h>

time_t get_time()
{
 struct timeval tv;

 gettimeofday(&tv, NULL);

 return tv.tv_sec;
}

int main(int argc, char* argv[])
{
 AVFormatContext* ifcx = NULL;
 AVCodecContext* iccx;
 AVStream* ist;
 int i_index;
 time_t timenow, timestart;

 AVFormatContext* ofcx;
 AVOutputFormat* ofmt;
 AVStream* ost;

 AVPacket pkt;

 int ix;

 const char* sProg = argv[0];
 const char* sFileInput;
 const char* sFileOutput;
 int bRunTime;

 if (argc != 4)
 {
 printf("Usage: %s url outfile runtime\n", sProg);
 return EXIT_FAILURE;
 }
 sFileInput = argv[1];
 sFileOutput = argv[2];
 bRunTime = atoi(argv[3]);

 // Initialize library
 av_log_set_level(AV_LOG_ERROR);
 avformat_network_init();

 //
 // Input
 //

 // open rtsp
 AVDictionary* opts = 0;
 av_dict_set(&opts, "rtsp_transport", "tcp", 0);
 if (avformat_open_input(&ifcx, sFileInput, 0, &opts) != 0)
 {
 printf("ERROR: Cannot open input file\n");
 return EXIT_FAILURE;
 }

 if (avformat_find_stream_info(ifcx, NULL) < 0)
 {
 printf("ERROR: Cannot find stream info\n");
 avformat_close_input(&ifcx);
 return EXIT_FAILURE;
 }

 snprintf(ifcx->url, sizeof(ifcx->url), "%s", sFileInput);

 // search video stream
 i_index = -1;
 AVCodecParameters* iccx_par;
 for (ix = 0; ix < ifcx->nb_streams; ix++)
 {
 iccx_par = ifcx->streams[ix]->codecpar;
 if (iccx_par->codec_type == AVMEDIA_TYPE_VIDEO)
 {
 ist = ifcx->streams[ix];
 i_index = ix;
 break;
 }
 }
 if (i_index < 0)
 {
 printf("ERROR: Cannot find input video stream\n");
 avformat_close_input(&ifcx);
 return EXIT_FAILURE;
 }

 // Allocate codec context and convert codec parameters to codec context
 iccx = avcodec_alloc_context3(NULL);
 avcodec_parameters_to_context(iccx, iccx_par);

 // set output format
 ofmt = av_guess_format("mp4", NULL, NULL);

 // create output context
 if (avformat_alloc_output_context2(&ofcx, ofmt, NULL, sFileOutput) < 0)
 {
 printf("ERROR: Cannot create output context\n");
 avformat_close_input(&ifcx);
 return EXIT_FAILURE;
 }

 // add video stream
 ost = avformat_new_stream(ofcx, NULL);
 if (!ost)
 {
 printf("ERROR: Cannot add output stream\n");
 avformat_close_input(&ifcx);
 avformat_free_context(ofcx);
 return EXIT_FAILURE;
 }

 // copy codec context
 if (avcodec_parameters_from_context(ost->codecpar, iccx) < 0)
 {
 printf("ERROR: Cannot copy codec context\n");
 avformat_close_input(&ifcx);
 avformat_free_context(ofcx);
 return EXIT_FAILURE;
 }

 // open output file
 if (!(ofmt->flags & AVFMT_NOFILE))
 {
 if (avio_open(&ofcx->pb, sFileOutput, AVIO_FLAG_WRITE) < 0)
 {
 printf("ERROR: Cannot open output file\n");
 avformat_close_input(&ifcx);
 avformat_free_context(ofcx);
 return EXIT_FAILURE;
 }
 }

 // write output file header
 if (avformat_write_header(ofcx, NULL) < 0)
 {
 printf("ERROR: Cannot write output file header\n");
 avformat_close_input(&ifcx);
 avio_close(ofcx->pb);
 avformat_free_context(ofcx);
 return EXIT_FAILURE;
 }

 //
 // Write data
 //
 AVRational time_base = ist->time_base;
 timestart = get_time();
 int64_t pts = 0;
 while (av_read_frame(ifcx, &pkt) >= 0)
 {
 if (get_time() - timestart > bRunTime)
 {
 break;
 }
 if (pkt.stream_index == i_index)
 {
 pkt.stream_index = ost->id;

 pkt.pts = pkt.duration * pts;
 pkt.dts = pkt.pts;

 if (av_interleaved_write_frame(ofcx, &pkt) < 0)
 {
 printf("ERROR: Cannot write packet\n");
 av_packet_unref(&pkt);
 break;
 }
 pts++;
 }
 }

 // write output file trailer
 if (av_write_trailer(ofcx) < 0)
 {
 printf("ERROR: Cannot write output file trailer\n");
 }

 //
 // Close
 //

 avformat_close_input(&ifcx);
 avio_close(ofcx->pb);
 avformat_free_context(ofcx);

 avformat_network_deinit();

 return EXIT_SUCCESS;
}



Compile :


gcc test.c -Wunused-variable -lavcodec -lavformat -lavfilter -lavdevice -lswresample -lswscale -lavutil -o a.out



Run :


./a.out rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4 out.mp4 5



Then using ffprobe, the video will last different time every time :
5.875000
6.500000


If i run the CLI


ffmpeg -t 5 -i rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4 -vcodec copy -acodec copy -map 0 -f mp4 out.mp4



It will always give 5.124000


What am I doing wrong ?


Thanks !