
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 (96)
-
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 ) (...) -
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
Sur d’autres sites (5726)
-
Ffmpeg stream works from cli but not inside bash script, no errors
21 juillet 2022, par Sidharth RaoI'm running an Ffmpeg stream on Ubuntu writing to an rtp address, and it appears to work perfectly from my cli every time but fails to actually write anything from inside a bash script. After running from inside the cli, the bash script works every time I run it for about the next 5 minutes and then starts failing without errors again.


Here is the command :


ffmpeg -i video.mp4 -fflags nobuffer -flags low_delay -s 640x480 -c:v libx264 -profile:v baseline -b:v 2M -r 24 -g 60 -an -rtsp_transport tcp -f rtp rtp://CENSOREDCENSORED:0000



Here is the bash script :


#!/bin/bash

ffmpeg -i video.mp4 -fflags nobuffer -flags low_delay -s 640x480 -c:v libx264 -profile:v baseline -b:v 2M -r 24 -g 60 -an -rtsp_transport tcp -f rtp rtp://CENSOREDCENSORED:0000



And here is the same output to cli for both of them :


ffmpeg version 3.4.11-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
 built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
 configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
 libavutil 55. 78.100 / 55. 78.100
 libavcodec 57.107.100 / 57.107.100
 libavformat 57. 83.100 / 57. 83.100
 libavdevice 57. 10.100 / 57. 10.100
 libavfilter 6.107.100 / 6.107.100
 libavresample 3. 7. 0 / 3. 7. 0
 libswscale 4. 8.100 / 4. 8.100
 libswresample 2. 9.100 / 2. 9.100
 libpostproc 54. 7.100 / 54. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 encoder : Lavf58.76.100
 Duration: 00:00:26.00, start: 0.000000, bitrate: 227 kb/s
 Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480, 226 kb/s, 2.31 fps, 2.31 tbr, 18464 tbn, 4.62 tbc (default)
 Metadata:
 handler_name : VideoHandler
Stream mapping:
 Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x5585318623c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x5585318623c0] profile Constrained Baseline, level 3.0
Output #0, rtp, to 'rtp://us.robotics.cognitedata.com:5005':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 encoder : Lavf57.83.100
 Stream #0:0(und): Video: h264 (libx264), yuv420p, 640x480, q=-1--1, 2000 kb/s, 24 fps, 90k tbn, 24 tbc (default)
 Metadata:
 handler_name : VideoHandler
 encoder : Lavc57.107.100 libx264
 Side data:
 cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 0 vbv_delay: -1
SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 20.232.153.224
t=0 0
a=tool:libavformat 57.83.100
m=video 5005 RTP/AVP 96
b=AS:2000
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1

frame= 624 fps=194 q=-1.0 Lsize= 6288kB time=00:00:25.95 bitrate=1984.3kbits/s dup=564 drop=0 speed=8.08x
video:6226kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.992690%
[libx264 @ 0x5585318623c0] frame I:11 Avg QP: 2.77 size:132437
[libx264 @ 0x5585318623c0] frame P:613 Avg QP: 4.97 size: 8024
[libx264 @ 0x5585318623c0] mb I I16..4: 20.2% 0.0% 79.8%
[libx264 @ 0x5585318623c0] mb P I16..4: 0.8% 0.0% 2.0% P16..4: 12.3% 1.0% 1.2% 0.0% 0.0% skip:82.6%
[libx264 @ 0x5585318623c0] final ratefactor: 6.07
[libx264 @ 0x5585318623c0] coded y,uvDC,uvAC intra: 87.7% 87.0% 68.2% inter: 8.6% 7.0% 6.6%
[libx264 @ 0x5585318623c0] i16 v,h,dc,p: 34% 15% 41% 10%
[libx264 @ 0x5585318623c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 24% 13% 3% 3% 3% 4% 3% 4%
[libx264 @ 0x5585318623c0] i8c dc,h,v,p: 36% 22% 37% 6%
[libx264 @ 0x5585318623c0] ref P L0: 97.5% 1.9% 0.6%
[libx264 @ 0x5585318623c0] kb/s:1961.69



The ffmpeg stream also fails from inside of a docker image.


-
Minimal sample of muxing two streams with no reencoding (av_interleaved_write_frame fails)
19 juillet 2022, par AlveinWhat I'm trying to do : having two files, one is video-only and the other is audio-only, with identical durations, I want to "join" them in a single container.


I previously made a routine which just copied all the streams inside a container to another one. No reencoding, etc. This works perfectly :


while(true) {
 pkIn=av_packet_alloc();
 if(NULL==pkIn) {
 fprintf(stderr,"av_packet_alloc() failed");
 break;
 }
 iError=av_read_frame(fcIn,pkIn);
 if(0>iError)
 if(AVERROR_EOF==iError)
 break;
 else {
 fprintf(stderr,"av_read_frame() failed");
 break;
 }
 stIn=fcIn->streams[pkIn->stream_index];
 stOut=fcOut->streams[pkIn->stream_index];
 log_packet(fcIn,pkIn,"in");
 av_packet_rescale_ts(pkIn,stIn->time_base,stOut->time_base);
 pkIn->pos=-1;
 log_packet(fcOut,pkIn,"out");
 iError=av_interleaved_write_frame(fcOut,pkIn);
 if(0>iError) {
 fprintf(stderr,"av_interleaved_write_frame() failed");
 break;
 }
 av_packet_free(&pkIn);
}



I just did the analogy and tried to do the same, but taking each stream from a distinct container, like this :


while(true) {
 if(!bVideoInEOF) {
 pkVideoIn=av_packet_alloc();
 if(NULL==pkVideoIn) {
 fprintf(stderr,"av_packet_alloc(video in) failed");
 break;
 }
 iError=av_read_frame(fcVideoIn,pkVideoIn);
 if(0>iError)
 if(AVERROR_EOF==iError)
 bVideoInEOF=true;
 else {
 fprintf(stderr,"av_read_frame(video in) failed");
 break;
 }
 if(!bVideoInEOF) {
 log_packet(fcVideoIn,pkVideoIn,"video in");
 av_packet_rescale_ts(pkVideoIn,stVideoIn->time_base,stVideoOut->time_base);
 pkVideoIn->pos=-1;
 pkVideoIn->stream_index=stVideoOut->index; // Edit (2022-07-19)
 log_packet(fcVideoIn,pkVideoIn,"video out");
 iError=av_interleaved_write_frame(fcOut,pkVideoIn);
 if(0>iError) {
 fprintf(stderr,"av_interleaved_write_frame(video out) failed");
 break;
 }
 }
 av_packet_free(&pkVideoIn);
 }
 if(!bAudioInEOF) {
 pkAudioIn=av_packet_alloc();
 if(NULL==pkAudioIn) {
 fprintf(stderr,"av_packet_alloc(audio in) failed");
 break;
 }
 iError=av_read_frame(fcAudioIn,pkAudioIn);
 if(0>iError)
 if(AVERROR_EOF==iError)
 bAudioInEOF=true;
 else {
 fprintf(stderr,"av_read_frame(audio in) failed");
 break;
 }
 if(!bAudioInEOF) {
 log_packet(fcAudioIn,pkAudioIn,"audio in");
 av_packet_rescale_ts(pkAudioIn,stAudioIn->time_base,stAudioOut->time_base);
 pkAudioIn->pos=-1;
 pkAudioIn->stream_index=stAudioOut->index; // Edit (2022-07-19)
 log_packet(fcAudioIn,pkAudioIn,"audio out");
 iError=av_interleaved_write_frame(fcOut,pkAudioIn);
 if(0>iError) {
 fprintf(stderr,"av_interleaved_write_frame(audio out) failed");
 break;
 }
 }
 av_packet_free(&pkAudioIn);
 }
 if(bVideoInEOF&&bAudioInEOF)
 break;
}



I know the previous code looks like redundant but I wanted to leave both streams "processing" separated the way you understand my plans.


Anyway, that code ends quickly with "av_interleaved_write_frame(audio out) failed".


The error detail is "Invalid argument", and the debugger shows this :




Application provided invalid, non monotonically increasing dts to
muxer in stream 0.




If I disable any of the main blocks "if(!bVideoInEOF)" / "if(!bAudioInEOF)", the file is written successfully, with the obvious lack of the disabled stream.


I'm new into using this library so probably I'm doing something really stupid, or missing something obvious.


Suggestions ?


Edit (2022-07-19) :


By checking the logs, I noticed I was writing every frame to the stream #0. Hence, the horrible jumps in PTS/DTS.


Code edited by adding the corresponding "...->stream_index=" before each call to av_interleaved_write_frame().


...


Though it works, I still think my code is far from perfect. Comments are welcome.


-
how to get precise video bit rate in a .ts file ?
26 juillet 2022, par Wang YilanI often use
ffprobe
to get video bitrates and audio bitrates, but when I usedffprobe
to get video bitrate of a .ts file, it seemed get wrong answers :

> ffprobe ts-5s/abs-Life_of_PI-01-05s-0.95-1.5-0.15.ts
ffprobe version N-107320-g3354f8695c Copyright (c) 2007-2022 the FFmpeg developers
 built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
 configuration: --enable-version3 --enable-libvmaf --enable-libx264 --enable-libx265 --enable-libvpx --enable-x86asm --enable-shared --disable-static --enable-gpl --enable-postproc --enable-hardcoded-tables --enable-pthreads --enable-pic --enable-zlib --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --extra-libs=-lcjson
 libavutil 57. 27.100 / 57. 27.100
 libavcodec 59. 36.100 / 59. 36.100
 libavformat 59. 26.100 / 59. 26.100
 libavdevice 59. 6.100 / 59. 6.100
 libavfilter 8. 41.100 / 8. 41.100
 libswscale 6. 6.100 / 6. 6.100
 libswresample 4. 6.100 / 4. 6.100
 libpostproc 56. 5.100 / 56. 5.100
Input #0, mpegts, from 'ts-5s/abs-Life_of_PI-01-05s-0.95-1.5-0.15.ts':
 Duration: 00:00:05.02, start: 1.472511, bitrate: 1423 kb/s
 Program 1
 Metadata:
 service_name : Service01
 service_provider: FFmpeg
 Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1280x688, 23.98 fps, 23.98 tbr, 90k tbn
 Stream #0:1[0x101](und): Audio: mp2 ([3][0][0][0] / 0x0003), 44100 Hz, stereo, fltp, 384 kb/s



it seemed that the bitrate is 1423k,but when I used
bitrate viewer
to get this result, it is 952k :


And 1423k-384k=1039k, it cannot match the result of bitrate-viewer, neither.


So my question are :


- 

- what result is the correct result of this .ts file ?
- Can I get this result in batches ? (using terminal commands or others)






many thanks.