Newest 'libx264' Questions - Stack Overflow
Les articles publiés sur le site
-
Converting avi to mp4 (use ffmpeg library) is very slow [closed]
7 décembre 2012, par yAnTarI have task - convert any video from user to mp4 format. I use command
ffmpeg -i $file -vcodec libx264 -vpre ultrafast -bt 500k -acodec libfaac -ab 56k -ac 2 -s 480x320 $outputFileMp4
I try to change options bitrate, dimensions, but spped of converting is slow - 3 mbytes convert arround 90 seconds.
If i convert avi to flv - no problem.
FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers built on Jan 29 2012 17:52:15 with gcc 4.4.5 20110214 (Red Hat 4.4.5-6) configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --enable-avfilter --enable-avfilter-lavf --enable-libdc1394 --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab libavutil 50.15. 1 / 50.15. 1 libavcodec 52.72. 2 / 52.72. 2 libavformat 52.64. 2 / 52.64. 2 libavdevice 52. 2. 0 / 52. 2. 0 libavfilter 1.19. 0 / 1.19. 0 libswscale 0.11. 0 / 0.11. 0 libpostproc 51. 2. 0 / 51. 2. 0 Input #0, avi, from 'intro.avi': Duration: 00:07:48.53, start: 0.000000, bitrate: 244 kb/s Stream #0.0: Video: camtasia, bgr24, 800x600, 15 tbr, 15 tbn, 15 tbc Metadata: strn : Camtasia Producer_render549ab1f.avi Video #1 Stream #0.1: Audio: pcm_s16le, 12000 Hz, 1 channels, s16, 192 kb/s Metadata: strn : Microsoft Waveform: Camtasia Producer_render549ab1f.wav [libx264 @ 0x1202e40]using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64 [libx264 @ 0x1202e40]profile Constrained Baseline, level 2.2 [libx264 @ 0x1202e40]264 - core 107 - H.264/MPEG-4 AVC codec - Copyleft 2003-2010 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0x1:0 me=dia subme=0 psy=1 psy_rd=0.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=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=abr mbtree=0 bitrate=200 ratetol=2.5 qcomp=0.60 qpmin=10 qpmax=51 qpstep=4 ip_ratio=1.41 aq=0 Output #0, mp4, to 'test2.mp4': Metadata: encoder : Lavf52.64.2 Stream #0.0: Video: libx264, yuv420p, 640x480, q=10-51, 200 kb/s, 15 tbn, 15 tbc Metadata: strn : Camtasia Producer_render549ab1f.avi Video #1 Stream #0.1: Audio: libfaac, 12000 Hz, 2 channels, s16, 5 kb/s Metadata: strn : Microsoft Waveform: Camtasia Producer_render549ab1f.wav Stream mapping: Stream #0.0 -> #0.0 Stream #0.1 -> #0.1
and result of executing
frame= 7028 fps= 52 q=10.0 Lsize= 2654kB time=468.31 bitrate= 46.4kbits/s video:1883kB audio:672kB global headers:0kB muxing overhead 3.876805% [libx264 @ 0xe1ee40]frame I:29 Avg QP:10.83 size: 25781 [libx264 @ 0xe1ee40]frame P:6999 Avg QP:10.08 size: 169 [libx264 @ 0xe1ee40]mb I I16..4: 80.1% 0.0% 19.9% [libx264 @ 0xe1ee40]mb P I16..4: 0.2% 0.0% 0.0% P16..4: 0.2% 0.0% 0.0% 0.0% 0.0% skip:99.6% [libx264 @ 0xe1ee40]final ratefactor: 5.71 [libx264 @ 0xe1ee40]coded y,uvDC,uvAC intra: 37.1% 3.3% 3.1% inter: 0.1% 0.0% 0.0% [libx264 @ 0xe1ee40]i16 v,h,dc,p: 87% 12% 1% 0% [libx264 @ 0xe1ee40]i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 23% 27% 8% 6% 3% 3% 2% 8% [libx264 @ 0xe1ee40]i8c dc,h,v,p: 94% 6% 0% 0% [libx264 @ 0xe1ee40]kb/s:32.91
-
"Unknown encoder libx264" on Windows [migrated]
29 novembre 2012, par shampooI'm testing ClipBucket on a Windows XP system, and ClipBucket (open source video share) uses FFmpeg to convert videos. The final command it executes is (i changed it a little to make it compatible with the current FFmpeg):
D:\ffmpeg-snapshot-git\ffmpeg\ffmpeg.exe -i C: \wamp\www\chclip/files/conversion_queue/1352973741c353c.mp4 -f flv -vcodec libx2 64 -pre normal -r 25 -s 426x240 -aspect 1.775 -vf "pad=10:20:30:40:yellow" -ac odec libfaac -ab 128000 -ar 22050 C:\wamp\www\chclip/files/videos/13540939451e18 4.flv 2> C:\wamp\www\chclip/files/temp/13540939461c124.tmp 2>&1
And this is the response I get:
ffmpeg version 1.0.git Copyright (c) 2000-2012 the FFmpeg developers built on Nov 19 2012 16:42:42 with gcc 4.6.2 (GCC) configuration: libavutil 52. 8.100 / 52. 8.100 libavcodec 54. 73.100 / 54. 73.100 libavformat 54. 37.100 / 54. 37.100 libavdevice 54. 3.100 / 54. 3.100 libavfilter 3. 23.101 / 3. 23.101 libswscale 2. 1.102 / 2. 1.102 libswresample 0. 16.100 / 0. 16.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\wamp\www\chclip/files/conversion_que ue/1352973741c353c.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf53.21.0 Duration: 00:00:51.67, start: 0.000000, bitrate: 344 kb/s Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 426x240 [ SAR 1:1 DAR 71:40], 308 kb/s, 15 fps, 15 tbr, 15 tbn, 30 tbc Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 31 kb/s Metadata: handler_name : SoundHandler Unknown encoder 'libx264'
How can I get this libx264 working in Windows?
-
unknown encoder libx264 windows
28 novembre 2012, par shampooi am testing clip bucket on a windows xp system , clip bucket (open source video share) uses ffmpeg to convert videos, the final command clip bucket executes is (i changed it a little to make it compatible with the current ffmpeg):
D:\ffmpeg-snapshot-git\ffmpeg\ffmpeg.exe -i C: \wamp\www\chclip/files/conversion_queue/1352973741c353c.mp4 -f flv -vcodec libx2 64 -pre normal -r 25 -s 426x240 -aspect 1.775 -vf "pad=10:20:30:40:yellow" -ac odec libfaac -ab 128000 -ar 22050 C:\wamp\www\chclip/files/videos/13540939451e18 4.flv 2> C:\wamp\www\chclip/files/temp/13540939461c124.tmp 2>&1
and this is the response i get
ffmpeg version 1.0.git Copyright (c) 2000-2012 the FFmpeg developers built on Nov 19 2012 16:42:42 with gcc 4.6.2 (GCC) configuration: libavutil 52. 8.100 / 52. 8.100 libavcodec 54. 73.100 / 54. 73.100 libavformat 54. 37.100 / 54. 37.100 libavdevice 54. 3.100 / 54. 3.100 libavfilter 3. 23.101 / 3. 23.101 libswscale 2. 1.102 / 2. 1.102 libswresample 0. 16.100 / 0. 16.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\wamp\www\chclip/files/conversion_que ue/1352973741c353c.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf53.21.0 Duration: 00:00:51.67, start: 0.000000, bitrate: 344 kb/s Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 426x240 [ SAR 1:1 DAR 71:40], 308 kb/s, 15 fps, 15 tbr, 15 tbn, 30 tbc Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 31 kb/s Metadata: handler_name : SoundHandler Unknown encoder 'libx264'
how can i get this libx264 working in windows?
-
Where ffmpeg flags like CODEC_FLAG2_BPYRAMID are located ?
27 novembre 2012, par theateistI'm developing on using VS2010 with ffmpeg and tried the code from here. But VS says that it cannot find
CODEC_FLAG2_BPYRAMID+CODEC_FLAG2_MIXED_REFS+CODEC_FLAG2_WPRED+CODEC_FLAG2_8X8DCT+CODEC_FLAG2_FASTPSKIP; // flags2=+bpyramid+mixed_refs+wpred+dct8x8+fastpskip
X264_PART_I8X8+X264_PART_I4X4+X264_PART_P8X8+X264_PART_B8X8
avCodecContext.crf
Where are they located?
-
fps porblem when saving video in mp4 container
27 novembre 2012, par theateistWhen I decode frames from avi file and then decode them in x264 and save to mp4 file, the fps of the output file is always 12,800. Therefore the file is played very fast. But, when I save the encoded in h264 frames in avi format and not mp4, so the fps is as I wanted - 25.
What could be the problem? This is very urgent to me. I'm stuck with this and cannot continue with my project!
Here the code I wrote in VS2010:
#include "stdafx.h" #include "inttypes.h" extern "C" { #include "libavcodec/avcodec.h" #include "libavformat/avformat.h" #include "libavutil/avutil.h" #include
swscale.h> #include opt.h> #include swscale.h> #include imgutils.h> } #include using namespace std; int main(int argc, char* argv[]) { const char* inFileName = "C:\\000227_C1_GAME.avi"; const char* outFileName = "c:\\test.avi"; const char* outFileType = "avi"; av_register_all(); AVFormatContext* inContainer = NULL; if(avformat_open_input(&inContainer, inFileName, NULL, NULL) < 0) exit(1); if(avformat_find_stream_info(inContainer, NULL) < 0) exit(1); // Find video stream int videoStreamIndex = -1; for (unsigned int i = 0; i < inContainer->nb_streams; ++i) { if (inContainer->streams[i] && inContainer->streams[i]->codec && inContainer->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) { videoStreamIndex = i; break; } } if (videoStreamIndex == -1) exit(1); AVFormatContext* outContainer = NULL; if(avformat_alloc_output_context2(&outContainer, NULL, outFileType, outFileName) < 0) exit(1); // ---------------------------- // Decoder // ---------------------------- AVStream const *const inStream = inContainer->streams[videoStreamIndex]; AVCodec *const decoder = avcodec_find_decoder(inStream->codec->codec_id); if(!decoder) exit(1); if(avcodec_open2(inStream->codec, decoder, NULL) < 0) exit(1); // ---------------------------- // Encoder // ---------------------------- AVCodec *encoder = avcodec_find_encoder(AV_CODEC_ID_H264); if(!encoder) exit(1); AVStream *outStream = avformat_new_stream(outContainer, encoder); if(!outStream) exit(1); avcodec_get_context_defaults3(outStream->codec, encoder); // Construct encoder if(outContainer->oformat->flags & AVFMT_GLOBALHEADER) outStream->codec->flags |= CODEC_FLAG_GLOBAL_HEADER; outStream->codec->coder_type = AVMEDIA_TYPE_VIDEO; outStream->codec->pix_fmt = AV_PIX_FMT_YUV420P; outStream->codec->width = inStream->codec->width; outStream->codec->height = inStream->codec->height; outStream->codec->codec_id = encoder->id; outStream->codec->bit_rate = 500000; //outStream->codec->rc_min_rate = 600000; //outStream->codec->rc_max_rate = 800000; outStream->codec->time_base.den = 25; outStream->codec->time_base.num = 1; outStream->codec->gop_size = 250; // Keyframe interval(=GOP length). Determines maximum distance distance between I-frames outStream->codec->keyint_min = 25; // minimum GOP size outStream->codec->max_b_frames = 3;//16; // maximum number of B-frames between non-B-frames outStream->codec->b_frame_strategy = 1; // decides the best number of B-frames to use. Default mode in x264. outStream->codec->scenechange_threshold = 40; outStream->codec->refs = 6; // abillity to reference frames other than the one immediately prior to the current frame. specify how many references can be used. outStream->codec->qmin = 0;//10; outStream->codec->qmax = 69;//51; outStream->codec->qcompress = 0.6; outStream->codec->max_qdiff = 4; outStream->codec->i_quant_factor = 1.4;//0.71; outStream->codec->refs=1;//3; outStream->codec->chromaoffset = -2; outStream->codec->thread_count = 1; outStream->codec->trellis = 1; outStream->codec->me_range = 16; outStream->codec->me_method = ME_HEX; //hex outStream->codec->flags2 |= CODEC_FLAG2_FAST; outStream->codec->coder_type = 1; if(outStream->codec->codec_id == AV_CODEC_ID_H264) { av_opt_set(outStream->codec->priv_data, "preset", "slow", 0); } // Open encoder if(avcodec_open2(outStream->codec, encoder, NULL) < 0) exit(1); // Open output container if(avio_open(&outContainer->pb, outFileName, AVIO_FLAG_WRITE) < 0) exit(1); //close_o AVFrame *decodedFrame = avcodec_alloc_frame(); if(!decodedFrame) exit(1); AVFrame *encodeFrame = avcodec_alloc_frame(); if(!encodeFrame) exit(1); encodeFrame->format = outStream->codec->pix_fmt; encodeFrame->width = outStream->codec->width; encodeFrame->height = outStream->codec->height; if(av_image_alloc(encodeFrame->data, encodeFrame->linesize, outStream->codec->width, outStream->codec->height, outStream->codec->pix_fmt, 1) < 0) exit(1); av_dump_format(inContainer, 0, inFileName,0); //Write header to ouput container avformat_write_header(outContainer, NULL); AVPacket decodePacket, encodedPacket; int got_frame, len; while(av_read_frame(inContainer, &decodePacket)>=0) { if (decodePacket.stream_index == videoStreamIndex) { len = avcodec_decode_video2(inStream->codec, decodedFrame, &got_frame, &decodePacket); if(len < 0) exit(1); if(got_frame) { av_init_packet(&encodedPacket); encodedPacket.data = NULL; encodedPacket.size = 0; if(avcodec_encode_video2(outStream->codec, &encodedPacket, decodedFrame, &got_frame) < 0) exit(1); if(got_frame) { if (outStream->codec->coded_frame->key_frame) encodedPacket.flags |= AV_PKT_FLAG_KEY; encodedPacket.stream_index = outStream->index; if(av_interleaved_write_frame(outContainer, &encodedPacket) < 0) exit(1); av_free_packet(&encodedPacket); } } } av_free_packet(&decodePacket); } av_write_trailer(outContainer); avio_close(outContainer->pb); avcodec_free_frame(&encodeFrame); avcodec_free_frame(&decodedFrame); avformat_free_context(outContainer); av_close_input_file(inContainer); return 0; }