
Recherche avancée
Autres articles (17)
-
Le plugin : Podcasts.
14 juillet 2010, parLe problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici ; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro ;
Types de fichiers supportés dans les flux
Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 (...) -
Librairies et logiciels spécifiques aux médias
10 décembre 2010, parPour un fonctionnement correct et optimal, plusieurs choses sont à prendre en considération.
Il est important, après avoir installé apache2, mysql et php5, d’installer d’autres logiciels nécessaires dont les installations sont décrites dans les liens afférants. Un ensemble de librairies multimedias (x264, libtheora, libvpx) utilisées pour l’encodage et le décodage des vidéos et sons afin de supporter le plus grand nombre de fichiers possibles. Cf. : ce tutoriel ; FFMpeg avec le maximum de décodeurs et (...) -
Encoding and processing into web-friendly formats
13 avril 2011, parMediaSPIP automatically converts uploaded files to internet-compatible formats.
Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
All uploaded files are stored online in their original format, so you can (...)
Sur d’autres sites (3912)
-
ffmpeg convert from H.264 (High 4:2:2 Profile) MOV to H.264 (Baseline Profile) MP4
26 juillet 2022, par froniqHow can I convert a video (MOV) from H.264 (High 4:2:2 Profile) to H.264 (Baseline Profile) MP4 using ffmpeg ?
I would run that mp4 video on android mobile in a VideoView to support as many mobile types as possible.


I can't do that with this command : ffmpeg -i o1.mov -c:v libx264 -profile:v baseline -c:a aac -ar 44100 -ac 2 -b:a 128k out.mp4.


That'd return an error :


ffmpeg version 5.0.1-essentials_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
 built with gcc 11.2.0 (Rev7, Built by MSYS2 project)
 configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
 libavutil 57. 17.100 / 57. 17.100
 libavcodec 59. 18.100 / 59. 18.100
 libavformat 59. 16.100 / 59. 16.100
 libavdevice 59. 4.100 / 59. 4.100
 libavfilter 8. 24.100 / 8. 24.100
 libswscale 6. 4.100 / 6. 4.100
 libswresample 4. 3.100 / 4. 3.100
 libpostproc 56. 3.100 / 56. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'o1.mov':
 Metadata:
 major_brand : qt
 minor_version : 537199360
 compatible_brands: qt
 creation_time : 2022-07-19T16:56:39.000000Z
 Duration: 00:00:07.72, start: 0.000000, bitrate: 117473 kb/s
 Stream #0:0[0x1](eng): Video: prores (Standard) (apcn / 0x6E637061), yuv422p10le(tv, bt709, progressive), 1080x1920, 114850 kb/s, SAR 1:1 DAR 9:16, 23.98 fps, 23.98 tbr, 24k tbn (default)
 Metadata:
 creation_time : 2022-07-19T16:56:39.000000Z
 handler_name : Apple Video Media Handler
 vendor_id : appl
 encoder : Apple ProRes 422
 timecode : 00:00:00:04
 Stream #0:1[0x2](eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)
 Metadata:
 creation_time : 2022-07-19T16:56:39.000000Z
 handler_name : Apple Sound Media Handler
 vendor_id :
 timecode : 00:00:00:04
 Stream #0:2[0x3](eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
 Metadata:
 creation_time : 2022-07-19T16:56:39.000000Z
 handler_name : Time Code Media Handler
 timecode : 00:00:00:04
Stream mapping:
 Stream #0:0 -> #0:0 (prores (native) -> h264 (libx264))
 Stream #0:1 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
x264 [error]: baseline profile doesn't support 4:2:2
[libx264 @ 0000014713a31ac0] Error setting profile baseline.
[libx264 @ 0000014713a31ac0] Possible profiles: baseline main high high10 high422 high444
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
Conversion failed!



-
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.