
Recherche avancée
Médias (1)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (44)
-
Qu’est ce qu’un éditorial
21 juin 2013, parEcrivez votre de point de vue dans un article. Celui-ci sera rangé dans une rubrique prévue à cet effet.
Un éditorial est un article de type texte uniquement. Il a pour objectif de ranger les points de vue dans une rubrique dédiée. Un seul éditorial est placé à la une en page d’accueil. Pour consulter les précédents, consultez la rubrique dédiée.
Vous pouvez personnaliser le formulaire de création d’un éditorial.
Formulaire de création d’un éditorial Dans le cas d’un document de type éditorial, les (...) -
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 tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)
Sur d’autres sites (9814)
-
Why ffmpeg/mplayer2 play sloppy something that vlc plays well ?
8 octobre 2015, par exebookWhile trying to play with mplayer2 or stream with ffmpeg, the video has a slight delay about every 12 seconds. Sometimes leading to distorted picture. But the same input plays back perfectly with vlc. What could be the reason for this ?
mplayer2 shows it’s infamous "YOUR SYSTEM IS TOO SLOW TO PLAY THIS", but neither of its suggestions make difference.
-
How to convert .srt file into ttml based xml subtitle file using ffmpeg ?
25 août 2023, par geo-freakI have an .srt subtitle file. I want to convert it into .ttml format(or xml) using ffmpeg command. I tried using traditional way to convert this. But ffmpeg throwing an error. Is there any way to convert this in Linux platform ? Or any other command line applications do this conversion ?


Below is the command I tried.


ffmpeg -i my_srt.srt -y srt-to-xml.xml -v verbose

ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Input #0, srt, from 'my_srt.srt':
Duration: N/A, bitrate: N/A
 Stream #0:0: Subtitle: subrip
Output #0, webm_dash_manifest, to 'srt-to-xml.xml':
Output file #0 does not contain any stream
[AVIOContext @ 0x5614924ef500] Statistics: 22267 bytes read, 0 seeks



I even tried like below.


ffmpeg -i my_srt.srt -y srt_to_ttml.ttml



It didn't work too.


-
FFMPEG Corrupt output remuxing MP4 (Using API in C) -First file OK, 2nd file onwards is not
25 janvier, par RichardPI have a simple application written in C - it takes the video from a RTSP camera and just writes to disk in 1 minute segments. The first file created works fine, plays on anlmost anything. The Second file does not play. Programatically, The trace shows they are the same code flows, but I cant seem to find where the problem is to allow the 2nd file to be play exactly the same as the first.


There are frames in the 2nd file but they are random. The second file is created EXACTLY the same way as the first.


Any help from a guru would be greatly appreciated.


EDIT : FIX - The output duration needs to be set before the trailer is written.


int actual_duration = (int)difftime(time(NULL), start_time);

for (int i = 0; i < output_ctx->nb_streams; i++) {
 output_ctx->streams[i]->duration = actual_duration * AV_TIME_BASE;
}

output_ctx->duration = actual_duration * AV_TIME_BASE;
printf("DURATION = %d\r\n",output_ctx->duration);

// Set the start_time for the output context
output_ctx->start_time = 0;

av_write_trailer(output_ctx);



Code flow


Open RTSP Stream 
A: Create File n context 
 Remux to file n 
 Wait for minute to change 
 Close File n context 
 increment n Goto A



Makefile


CC = gcc
CFLAGS = -Wall -g
LIBS = -lavformat -lavcodec -lavutil -lavdevice -lswscale -lavfilter -lavutil -lm -lz -lpthread

TARGET = rtsp_remux

all: $(TARGET)

$(TARGET): rtsp_remux.o
 $(CC) -o $(TARGET) rtsp_remux.o $(LIBS)

rtsp_remux.o: rtsp_remux.c
 $(CC) $(CFLAGS) -c rtsp_remux.c

clean:
 rm -f $(TARGET) rtsp_remux.o

.PHONY: all clean



rtsp_remux.c


#include <libavformat></libavformat>avformat.h>
#include <libavutil></libavutil>time.h>
#include 
#include 

#define OUTPUT_PREFIX "output"
#define OUTPUT_EXTENSION ".mp4"
#define MAX_FILES 4

int main(int argc, char *argv[]) {
 if (argc < 2) {
 fprintf(stderr, "Usage: %s <rtsp url="url">\n", argv[0]);
 return -1;
 }

 const char *rtsp_url = argv[1];
 AVFormatContext *input_ctx = NULL, *output_ctx = NULL;
 AVOutputFormat *output_fmt = NULL;
 AVPacket pkt;
 int ret, file_count = 0;
 char output_filename[1024];
 time_t current_time;
 struct tm *timeinfo;
 int rename_lock = 0;

 avformat_network_init();

 if ((ret = avformat_open_input(&input_ctx, rtsp_url, NULL, NULL)) < 0) {
 fprintf(stderr, "Could not open input file '%s'\n", rtsp_url);
 return -1;
 }

 if ((ret = avformat_find_stream_info(input_ctx, NULL)) < 0) {
 fprintf(stderr, "Failed to retrieve input stream information\n");
 return -1;
 }

 av_dump_format(input_ctx, 0, rtsp_url, 0);

 while (file_count < MAX_FILES) {
 snprintf(output_filename, sizeof(output_filename), "%s_%03d%s", OUTPUT_PREFIX, file_count, OUTPUT_EXTENSION);

 if ((ret = avformat_alloc_output_context2(&output_ctx, NULL, NULL, output_filename)) < 0) {
 fprintf(stderr, "Could not create output context\n");
 return -1;
 }

 output_fmt = output_ctx->oformat;

 for (int i = 0; i < input_ctx->nb_streams; i++) {
 AVStream *in_stream = input_ctx->streams[i];
 AVStream *out_stream = avformat_new_stream(output_ctx, NULL);
 if (!out_stream) {
 fprintf(stderr, "Failed allocating output stream\n");
 return -1;
 }

 if ((ret = avcodec_parameters_copy(out_stream->codecpar, in_stream->codecpar)) < 0) {
 fprintf(stderr, "Failed to copy codec parameters\n");
 return -1;
 }
 out_stream->codecpar->codec_tag = 0;
 }

 if (!(output_fmt->flags & AVFMT_NOFILE)) {
 if ((ret = avio_open(&output_ctx->pb, output_filename, AVIO_FLAG_WRITE)) < 0) {
 fprintf(stderr, "Could not open output file '%s'\n", output_filename);
 return -1;
 }
 }

 if ((ret = avformat_write_header(output_ctx, NULL)) < 0) {
 fprintf(stderr, "Error occurred when opening output file\n");
 return -1;
 }

 while (1) {
 current_time = time(NULL);
 timeinfo = localtime(&current_time);

 if (timeinfo->tm_sec == 0 && !rename_lock) {
 rename_lock = 1;
 break;
 } else if (timeinfo->tm_sec != 0) {
 rename_lock = 0;
 }

 if ((ret = av_read_frame(input_ctx, &pkt)) < 0)
 break;

 AVStream *in_stream = input_ctx->streams[pkt.stream_index];
 AVStream *out_stream = output_ctx->streams[pkt.stream_index];

 pkt.pts = av_rescale_q_rnd(pkt.pts, in_stream->time_base, out_stream->time_base, AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX);
 pkt.dts = av_rescale_q_rnd(pkt.dts, in_stream->time_base, out_stream->time_base, AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX);
 pkt.duration = av_rescale_q(pkt.duration, in_stream->time_base, out_stream->time_base);
 pkt.pos = -1;

 if ((ret = av_interleaved_write_frame(output_ctx, &pkt)) < 0) {
 fprintf(stderr, "Error muxing packet\n");
 break;
 }

 av_packet_unref(&pkt);
 }

 av_write_trailer(output_ctx);

 if (!(output_fmt->flags & AVFMT_NOFILE))
 avio_closep(&output_ctx->pb);

 avformat_free_context(output_ctx);

 file_count++;
 }

 avformat_close_input(&input_ctx);
 avformat_network_deinit();

 return 0;
}
</rtsp>


I have tried changing to pointers, freeing and different things. I was expecting the 2nd file created to behave identically to the first.