
Recherche avancée
Autres articles (96)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Les vidéos
21 avril 2011, parComme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...) -
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 (...)
Sur d’autres sites (6679)
-
Ffmpeg live streaming to Youtube - "Connect streaming software to start preview"
10 septembre 2019, par Zoltan FedorI have an rtsp feed (H.265) which I am trying to stream to YouTube Live, but whatever I do YouTube Studio just showing the waiting icon with "Connect streaming software to start preview".
.sh file for streaming :
VBR="1000k"
FPS="30"
QUAL="ultrafast"
YOUTUBE_URL="rtmp://b.rtmp.youtube.com/live2"
SOURCE="rtsp://qhatever.org:8555/whatever.sdp"
KEY="xxxx-xxxx-xxxx-xxxx"
~/ffmpeg-git-20190905-amd64-static/ffmpeg \
-thread_queue_size 512 \
-rtsp_transport tcp -i "$SOURCE" \
-f lavfi -i anullsrc \
-vcodec libx264 -pix_fmt yuvj420p -preset $QUAL -r $FPS -g $(($FPS * 2)) -b:v 2250k -minrate $VBR -maxrate 6000k -bufsize 6000k -keyint_min 60 \
-acodec libmp3lame -ar 44100 -b:a 128k \
-f flv "$YOUTUBE_URL/$KEY"Ffmpeg’s output :
ffmpeg version N-49800-g2b66c757d6-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
libavutil 56. 35.100 / 56. 35.100
libavcodec 58. 56.101 / 58. 56.101
libavformat 58. 32.104 / 58. 32.104
libavdevice 58. 9.100 / 58. 9.100
libavfilter 7. 58.102 / 7. 58.102
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
Input #0, rtsp, from 'rtsp://whatever.org:8555/whatever.sdp':
Metadata:
title : streamed by the Rtsp Server
comment : RTSP_STREAM_0
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: hevc (Main), yuvj420p(pc, bt709), 1920x1080, 30 fps, 30 tbr, 90k tbn, 30 tbc
Stream #0:1: Data: none
Input #1, lavfi, from 'anullsrc':
Duration: N/A, start: 0.000000, bitrate: 705 kb/s
Stream #1:0: Audio: pcm_u8, 44100 Hz, stereo, u8, 705 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (hevc (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (pcm_u8 (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[hevc @ 0x5fbfd80] Could not find ref with POC 4
[libx264 @ 0x5fb9d80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x5fb9d80] profile Constrained Baseline, level 4.0, 4:2:0, 8-bit
[libx264 @ 0x5fb9d80] 264 - core 157 r2969 d4099dd - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=60 keyint_min=31 scenecut=0 intra_refresh=0 rc_lookahead=0 rc=abr mbtree=0 bitrate=2250 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=6000 vbv_bufsize=6000 nal_hrd=none filler=0 ip_ratio=1.40 aq=0
Output #0, flv, to 'rtmp://b.rtmp.youtube.com/live2/xxxx-xxxx-xxxx-xxxx':
Metadata:
title : streamed by the Rtsp Server
comment : RTSP_STREAM_0
encoder : Lavf58.32.104
Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuvj420p(pc, progressive), 1920x1080, q=-1--1, 2250 kb/s, 30 fps, 1k tbn, 30 tbc
Metadata:
encoder : Lavc58.56.101 libx264
Side data:
cpb: bitrate max/min/avg: 6000000/0/2250000 buffer size: 6000000 vbv_delay: N/A
Stream #0:1: Audio: mp3 (libmp3lame) ([2][0][0][0] / 0x0002), 44100 Hz, stereo, s16p, 128 kb/s
Metadata:
encoder : Lavc58.56.101 libmp3lame
frame= 522 fps=31 q=19.0 size= 8802Kb time=00:00:36:53 bitrate 2481.0kbits/s dup= drop=2 speed=1.01xBasically all looks good to me - still, in YouTube Studio only the waiting icon with the "Connect streaming software to start preview" message is visible, not video feed.
Any ideas ?
-
setPTS outputting wrong duration (Ffmpeg)
16 septembre 2020, par WebDivaI have a video of duration 14 seconds. I applied the setPTS filter to make it 3 times slow. So the total duration should be 42s (14*3). But the output gives a 49s long video. Here is the command :


ffmpeg -i video.mp4 -filter_complex "[0:v]setpts=3*PTS[v];[0:a]atempo=0.6,atempo=0.5[a]" -map "[v]" -map "[a]" output.mp4



What is wrong with this command ? I tried it for different videos but all has the same weird issue. Any help will be appreciated. Regards.


Log :


ffmpeg version git-2020-08-31-4a11a6f Copyright (c) 2000-2020 the FFmpeg developers
 built with gcc 10.2.1 (GCC) 20200805
 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --enable-librav1e --enable-libsvtav1 --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
 libavutil 56. 58.100 / 56. 58.100
 libavcodec 58.101.101 / 58.101.101
 libavformat 58. 51.101 / 58. 51.101
 libavdevice 58. 11.101 / 58. 11.101
 libavfilter 7. 87.100 / 7. 87.100
 libswscale 5. 8.100 / 5. 8.100
 libswresample 3. 8.100 / 3. 8.100
 libpostproc 55. 8.100 / 55. 8.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
 Metadata:
 major_brand : mp42
 minor_version : 0
 compatible_brands: isommp42
 creation_time : 2018-11-20T06:28:07.000000Z
 Duration: 00:00:14.72, start: 0.000000, bitrate: 688 kb/s
 Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, unknown/bt470bg/unknown), 198x360 [SAR 1:1 DAR 11:20], 592 kb/s, 29.93 fps, 29.93 tbr, 29931 tbn, 59.86 tbc (default)
 Metadata:
 handler_name : VideoHandler
 Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s (default)
 Metadata:
 creation_time : 2018-11-20T06:28:07.000000Z
 handler_name : IsoMedia File Produced by Google, 5-11-2011
File 'output.mp4' already exists. Overwrite? [y/N] y
Stream mapping:
 Stream #0:0 (h264) -> setpts
 Stream #0:1 (aac) -> atempo
 setpts -> Stream #0:0 (libx264)
 atempo -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
[libx264 @ 0000021e37f15340] using SAR=1/1
[libx264 @ 0000021e37f15340] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0000021e37f15340] profile High, level 1.3, 4:2:0, 8-bit
[libx264 @ 0000021e37f15340] 264 - core 161 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output.mp4':
 Metadata:
 major_brand : mp42
 minor_version : 0
 compatible_brands: isommp42
 encoder : Lavf58.51.101
 Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 198x360 [SAR 1:1 DAR 11:20], q=-1--1, 29.93 fps, 29931 tbn, 29.93 tbc (default)
 Metadata:
 encoder : Lavc58.101.101 libx264
 Side data:
 cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
 Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
 Metadata:
 encoder : Lavc58.101.101 aac
frame= 1313 fps=256 q=-1.0 Lsize= 2241kB time=00:00:44.11 bitrate= 416.2kbits/s dup=875 drop=0 speed=8.61x
video:1500kB audio:693kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.182632%
[libx264 @ 0000021e37f15340] frame I:7 Avg QP:21.61 size: 18425
[libx264 @ 0000021e37f15340] frame P:331 Avg QP:24.78 size: 3593
[libx264 @ 0000021e37f15340] frame B:975 Avg QP:31.57 size: 223
[libx264 @ 0000021e37f15340] consecutive B-frames: 0.8% 0.2% 1.6% 97.5%
[libx264 @ 0000021e37f15340] mb I I16..4: 3.6% 31.1% 65.3%
[libx264 @ 0000021e37f15340] mb P I16..4: 0.8% 1.3% 4.2% P16..4: 37.0% 29.0% 15.9% 0.0% 0.0% skip:11.7%
[libx264 @ 0000021e37f15340] mb B I16..4: 0.0% 0.0% 0.2% B16..8: 8.4% 2.8% 1.2% direct: 0.4% skip:87.0% L0:61.8% L1:31.0% BI: 7.3%
[libx264 @ 0000021e37f15340] 8x8 transform intra:22.3% inter:18.7%
[libx264 @ 0000021e37f15340] coded y,uvDC,uvAC intra: 73.2% 85.7% 52.9% inter: 11.6% 7.4% 0.7%
[libx264 @ 0000021e37f15340] i16 v,h,dc,p: 25% 33% 22% 19%
[libx264 @ 0000021e37f15340] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 28% 19% 4% 5% 4% 7% 5% 7%
[libx264 @ 0000021e37f15340] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 26% 13% 5% 7% 6% 7% 6% 7%
[libx264 @ 0000021e37f15340] i8c dc,h,v,p: 38% 29% 22% 11%
[libx264 @ 0000021e37f15340] Weighted P-Frames: Y:2.7% UV:0.3%
[libx264 @ 0000021e37f15340] ref P L0: 86.1% 8.9% 3.6% 1.4% 0.1%
[libx264 @ 0000021e37f15340] ref B L0: 94.7% 4.6% 0.8%
[libx264 @ 0000021e37f15340] ref B L1: 99.3% 0.7%
[libx264 @ 0000021e37f15340] kb/s:280.02
[aac @ 0000021e3847c900] Qavg: 729.586



-
C++ FFmpeg create mp4 file
1er février 2021, par DDovzhenkoI'm trying to create mp4 video file with FFmpeg and C++, but in result I receive broken file (windows player shows "Can't play ... 0xc00d36c4"). If I create .h264 file, it can be played with 'ffplay' and successfully converted to mp4 via CL.



My code :



int main() {
 char *filename = "tmp.mp4";
 AVOutputFormat *fmt;
 AVFormatContext *fctx;
 AVCodecContext *cctx;
 AVStream *st;

 av_register_all();
 avcodec_register_all();

 //auto detect the output format from the name
 fmt = av_guess_format(NULL, filename, NULL);
 if (!fmt) {
 cout << "Error av_guess_format()" << endl; system("pause"); exit(1);
 }

 if (avformat_alloc_output_context2(&fctx, fmt, NULL, filename) < 0) {
 cout << "Error avformat_alloc_output_context2()" << endl; system("pause"); exit(1);
 }


 //stream creation + parameters
 st = avformat_new_stream(fctx, 0);
 if (!st) {
 cout << "Error avformat_new_stream()" << endl; system("pause"); exit(1);
 }

 st->codecpar->codec_id = fmt->video_codec;
 st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
 st->codecpar->width = 352;
 st->codecpar->height = 288;
 st->time_base.num = 1;
 st->time_base.den = 25;

 AVCodec *pCodec = avcodec_find_encoder(st->codecpar->codec_id);
 if (!pCodec) {
 cout << "Error avcodec_find_encoder()" << endl; system("pause"); exit(1);
 }

 cctx = avcodec_alloc_context3(pCodec);
 if (!cctx) {
 cout << "Error avcodec_alloc_context3()" << endl; system("pause"); exit(1);
 }

 avcodec_parameters_to_context(cctx, st->codecpar);
 cctx->bit_rate = 400000;
 cctx->width = 352;
 cctx->height = 288;
 cctx->time_base.num = 1;
 cctx->time_base.den = 25;
 cctx->gop_size = 12;
 cctx->pix_fmt = AV_PIX_FMT_YUV420P;
 if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
 av_opt_set(cctx->priv_data, "preset", "ultrafast", 0);
 }
 if (fctx->oformat->flags & AVFMT_GLOBALHEADER) {
 cctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
 }
 avcodec_parameters_from_context(st->codecpar, cctx);

 av_dump_format(fctx, 0, filename, 1);

 //OPEN FILE + WRITE HEADER
 if (avcodec_open2(cctx, pCodec, NULL) < 0) {
 cout << "Error avcodec_open2()" << endl; system("pause"); exit(1);
 }
 if (!(fmt->flags & AVFMT_NOFILE)) {
 if (avio_open(&fctx->pb, filename, AVIO_FLAG_WRITE) < 0) {
 cout << "Error avio_open()" << endl; system("pause"); exit(1);
 }
 }
 if (avformat_write_header(fctx, NULL) < 0) {
 cout << "Error avformat_write_header()" << endl; system("pause"); exit(1);
 }


 //CREATE DUMMY VIDEO
 AVFrame *frame = av_frame_alloc();
 frame->format = cctx->pix_fmt;
 frame->width = cctx->width;
 frame->height = cctx->height;
 av_image_alloc(frame->data, frame->linesize, cctx->width, cctx->height, cctx->pix_fmt, 32);

 AVPacket pkt;
 double video_pts = 0;
 for (int i = 0; i < 50; i++) {
 video_pts = (double)cctx->time_base.num / cctx->time_base.den * 90 * i;

 for (int y = 0; y < cctx->height; y++) {
 for (int x = 0; x < cctx->width; x++) {
 frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3;
 if (y < cctx->height / 2 && x < cctx->width / 2) {
 /* Cb and Cr */
 frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2;
 frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5;
 }
 }
 }

 av_init_packet(&pkt);
 pkt.flags |= AV_PKT_FLAG_KEY;
 pkt.pts = frame->pts = video_pts;
 pkt.data = NULL;
 pkt.size = 0;
 pkt.stream_index = st->index;

 if (avcodec_send_frame(cctx, frame) < 0) {
 cout << "Error avcodec_send_frame()" << endl; system("pause"); exit(1);
 }
 if (avcodec_receive_packet(cctx, &pkt) == 0) {
 //cout << "Write frame " << to_string((int) pkt.pts) << endl;
 av_interleaved_write_frame(fctx, &pkt);
 av_packet_unref(&pkt);
 }
 }

 //DELAYED FRAMES
 for (;;) {
 avcodec_send_frame(cctx, NULL);
 if (avcodec_receive_packet(cctx, &pkt) == 0) {
 //cout << "-Write frame " << to_string((int)pkt.pts) << endl;
 av_interleaved_write_frame(fctx, &pkt);
 av_packet_unref(&pkt);
 }
 else {
 break;
 }
 }

 //FINISH
 av_write_trailer(fctx);
 if (!(fmt->flags & AVFMT_NOFILE)) {
 if (avio_close(fctx->pb) < 0) {
 cout << "Error avio_close()" << endl; system("pause"); exit(1);
 }
 }
 av_frame_free(&frame);
 avcodec_free_context(&cctx);
 avformat_free_context(fctx);

 system("pause");
 return 0;
}




Output of program :



Output #0, mp4, to 'tmp.mp4':
 Stream #0:0: Video: h264, yuv420p, 352x288, q=2-31, 400 kb/s, 25 tbn
[libx264 @ 0000021c4a995ba0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0000021c4a995ba0] profile Constrained Baseline, level 2.0
[libx264 @ 0000021c4a995ba0] 264 - core 152 r2851 ba24899 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=12 keyint_min=1 scenecut=0 intra_refresh=0 rc=abr mbtree=0 bitrate=400 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
[libx264 @ 0000021c4a995ba0] frame I:5 Avg QP: 7.03 size: 9318
[libx264 @ 0000021c4a995ba0] frame P:45 Avg QP: 4.53 size: 4258
[libx264 @ 0000021c4a995ba0] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 @ 0000021c4a995ba0] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 100.0% 0.0% 0.0% 0.0% 0.0% skip: 0.0%
[libx264 @ 0000021c4a995ba0] final ratefactor: 9.11
[libx264 @ 0000021c4a995ba0] coded y,uvDC,uvAC intra: 18.9% 21.8% 14.5% inter: 7.8% 100.0% 15.5%
[libx264 @ 0000021c4a995ba0] i16 v,h,dc,p: 4% 5% 5% 86%
[libx264 @ 0000021c4a995ba0] i8c dc,h,v,p: 2% 9% 6% 82%
[libx264 @ 0000021c4a995ba0] kb/s:264.68




If I will try to play mp4 file with 'ffplay' it prints :



[mov,mp4,m4a,3gp,3g2,mj2 @ 00000000026bf900] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 352x288, 138953 kb/s): unspecified pixel format
[h264 @ 00000000006c6ae0] non-existing PPS 0 referenced
[h264 @ 00000000006c6ae0] decode_slice_header error
[h264 @ 00000000006c6ae0] no frame!




I've spent a lot of time without success of finding issue, what could be the reason of it ?



Thank for help !