Newest 'x264' Questions - Stack Overflow
Les articles publiés sur le site
-
Powershell Script Exits Handbrake CLI
23 décembre 2014, par Arnav AttriWith the help of google, I workaround a Powershell script for handbrake automation. Now, the issue is when the source folder is empty the Powershell script exits.
Here's the scenario:
- I downloaded someone files - automated via RSS.
- They are placed in source folder.
- Powershell script works and encoding starts and successfully gets over.
- Now, when the encode is completed and in case of new download/file doesn't arrive in the source folder, the script exits.
Code is in PasteBin which has more comments but should be easy to infer what the script does
$inputpath = "I:\S" $outputpath = "I:\E" $movies = ls $inputpath foreach($movie in $movies){ $name = $movie.basename if(!(test-path -path "$outputpath\$name.mkv")){ C:\"Program Files"\handbrake\HandBrakeCLI.exe -i "$inputpath\$movie" -o "$outputpath\$name.mkv" ` -e x264 -b 1000 -2 -T -a 1,1 -E mp3 -B 112 --mixdown stereo -f mkv --detelecine --decomb ` --loose-anamorphic -m -x rc-lookahead=30:ref=4:bframes=3:me=umh:subme=9:analyse=none:deblock=1:0:0:8x8dct=1 } }
-
ffmpeg conversion x264 [error] : malloc of size 769152 failed
18 décembre 2014, par prashanthpI am trying to convert video recorded from Android smart watch (.mp4 format) to a format (.mp4) which playable on all browsers. The video recorded from smart watch is not playing in the browsers. so, i've used ffmpeg to convert in into a playable mp4 format.
But sometimes it is showing error as
x264 [error]: malloc of size 503008 failed
What is the reason for this. Sometimes it's getting converted and sometimes it is showing error .
Here is the console output.
/usr/local/ffmpeg_build/ffmpeg/bin/ffmpeg -i /home/xestatt1/public_html/app/webroot/mobile/uploads/in/Dec152014161945.mp4 -vcodec libx264 -r 24 -s 352*288 -acodec aac -ab 12k -strict -2 /home/xestatt1/public_html/app/webroot/mobile/uploads/out/ot12.mp4 ffmpeg version 2.5.git Copyright (c) 2000-2014 the FFmpeg developers built on Dec 13 2014 05:42:08 with gcc 4.1.2 (GCC) 20080704 (Red Hat 4.1.2-55) configuration: --prefix=/usr/local/ffmpeg_build/ffmpeg --enable-libx264 --enable-gpl --extra-cflags=-I/usr/local/ffmpeg_build/x264/include --extra-ldflags=-L/usr/local/ffmpeg_build/x264/lib libavutil 54. 15.100 / 54. 15.100 libavcodec 56. 14.100 / 56. 14.100 libavformat 56. 15.103 / 56. 15.103 libavdevice 56. 3.100 / 56. 3.100 libavfilter 5. 2.103 / 5. 2.103 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 3.100 / 53. 3.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/xestatt1/public_html/app/webroot/mobile/uploads/in/Dec152014161945.mp4': Metadata: major_brand : 3gp4 minor_version : 0 compatible_brands: isom3gp4 creation_time : 2014-12-15 10:50:02 Duration: 00:00:10.12, start: 0.000000, bitrate: 151 kb/s Stream #0:0(eng): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 135 kb/s, 13.14 fps, 50 tbr, 90k tbn, 200 tbc (default) Metadata: creation_time : 2014-12-15 10:50:02 handler_name : VideoHandle encoder : Stream #0:1(eng): Audio: amr_nb (samr / 0x726D6173), 8000 Hz, mono, flt, 12 kb/s (default) Metadata: creation_time : 2014-12-15 10:50:02 handler_name : SoundHandle File '/home/xestatt1/public_html/app/webroot/mobile/uploads/out/ot12.mp4' already exists. Overwrite ? [y/N] y [libx264 @ 0x13b69120] using SAR=12/11 [libx264 @ 0x13b69120] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64 [libx264 @ 0x13b69120] profile High, level 1.3 [libx264 @ 0x13b69120] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - 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=12 lookahead_threads=2 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=24 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 '/home/xestatt1/public_html/app/webroot/mobile/uploads/out/ot12.mp4': Metadata: major_brand : 3gp4 minor_version : 0 compatible_brands: isom3gp4 encoder : Lavf56.15.103 Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 352x288 [SAR 12:11 DAR 4:3], q=-1--1, 24 fps, 12288 tbn, 24 tbc (default) Metadata: creation_time : 2014-12-15 10:50:02 handler_name : VideoHandle encoder : Lavc56.14.100 libx264 Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 8000 Hz, mono, fltp, 12 kb/s (default) Metadata: creation_time : 2014-12-15 10:50:02 handler_name : SoundHandle encoder : Lavc56.14.100 aac Stream mapping: Stream #0:0 -> #0:0 (mpeg4 (native) -> h264 (libx264)) Stream #0:1 -> #0:1 (amr_nb (amrnb) -> aac (native)) Press [q] to stop, [?] for help Past duration 1.000000 too large Multiple frames in a packet from stream 1 Past duration 1.000000 too large av_interleaved_write_frame(): Cannot allocate memory x264 [error]: malloc of size 769152 failed Video encoding failed [libx264 @ 0x13b69120] frame I:1 Avg QP:22.20 size: 3166 [libx264 @ 0x13b69120] mb I I16..4: 28.3% 70.5% 1.3% [libx264 @ 0x13b69120] 8x8 transform intra:70.5% [libx264 @ 0x13b69120] coded y,uvDC,uvAC intra: 47.5% 55.3% 12.4% [libx264 @ 0x13b69120] i16 v,h,dc,p: 16% 26% 6% 52% [libx264 @ 0x13b69120] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 19% 15% 12% 3% 3% 3% 5% 16% [libx264 @ 0x13b69120] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 2% 20% 10% 16% 14% 4% 11% 6% [libx264 @ 0x13b69120] i8c dc,h,v,p: 61% 17% 19% 4% [libx264 @ 0x13b69120] kb/s:607.87 [aac @ 0x13b6a4c0] 2 frames left in the queue on closing Conversion failed!
UPDATED
When i execute this from shell it is working fine. But when i create a script file and trying to execute that script file from php , it is showing error's. I increased the memory limit in php, still it is showing error. Also , we are using ZEND framework. Is there any problems with ZEND??
-
How can I quantitatively measure gstreamer H264 latency between source and display ?
16 décembre 2014, par KevinMI have a project where we are using gstreamer , x264, etc, to multicast a video stream over a local network to multiple receivers (dedicated computers attached to monitors). We're using gstreamer on both the video source (camera) systems and the display monitors.
We're using RTP, payload 96, and libx264 to encode the video stream (no audio).
But now I need to quantify the latency between (as close as possible to) frame acquisition and display.
Does anyone have suggestions that use the existing software?
Ideally I'd like to be able to run the testing software for a few hours to generate enough statistics to quantify the system. Meaning that I can't do one-off tests like point the source camera at the receiving display monitor displaying a high resolution and manually calculate the difference...
I do realise that using a pure software-only solution, I will not be able to quantify the video acquisition delay (i.e. CCD to framebuffer).
I can arrange that the system clocks on the source and display systems are synchronised to a high accuracy (using PTP), so I will be able to trust the system clocks (else I will use some software to track the difference between the system clocks and remove this from the test results).
In case it helps, the project applications are written in C++, so I can use C event callbacks, if they're available, to consider embedding system time in a custom header (e.g. frame xyz, encoded at time TTT - and use the same information on the receiver to calculate a difference).
-
h264 ffmpeg : How to initialize ffmpeg to decode NALs created with x264
14 décembre 2014, par Raul CalvoI have encoded some frames using x264, using x264_encoder_encode and after that I have created AVPackets using a function like this:
bool PacketizeNals( uint8_t* a_pNalBuffer, int a_nNalBufferSize, AVPacket* a_pPacket ) { if ( !a_pPacket ) return false; a_pPacket->data = a_pNalBuffer; a_pPacket->size = a_nNalBufferSize; a_pPacket->stream_index = 0; a_pPacket->flags = AV_PKT_FLAG_KEY; a_pPacket->pts = int64_t(0x8000000000000000); a_pPacket->dts = int64_t(0x8000000000000000); }
I call this function like this:
x264_nal_t* nals; int num_nals = encode_frame(pic, &nals); for (int i = 0; i < num_nals; i++) { AVPacket* pPacket = ( AVPacket* )av_malloc( sizeof( AVPacket ) ); av_init_packet( pPacket ); if ( PacketizeNals( nals[i].p_payload, nals[i].i_payload, pPacket ) ) { packets.push_back( pPacket ); } }
Now what I want to do is to decode these AVPackets using avcodec_decode_video2. I think the problem is that I haven't initialized properly the decoder because to encode I used "ultrafast" profile and "zerolatency" tune ( x264 ) and to decode I don't know how to specify to ffmpeg these options. In some examples I have read people initialize the decoder using the file where the video is stored, but in this case I have directly the AVPackets. What I'm doing to try to decode is:
avcodec_init(); avcodec_register_all(); AVCodec* pCodec; pCodec=avcodec_find_decoder(CODEC_ID_H264); AVCodecContext* pCodecContext; pCodecContext=avcodec_alloc_context(); avcodec_open(pCodecContext,pCodec); pCodecContext->width = 320; pCodecContext->height = 200; pCodecContext->extradata = NULL; unsigned int nNumPackets = packets.size(); int frameFinished = 0; for ( auto it = packets.begin(); it != packets.end(); it++ ) { AVFrame* pFrame; pFrame = avcodec_alloc_frame(); AVPacket* pPacket = *it; int iReturn = avcodec_decode_video2( pCodecContext, pFrame, &frameFinished, pPacket ); }
But in iReturn always is -1.
Can anyone help me? Sorry if my knowledge in this area es low, I'm new.
Thanks.
-
C++ ffmpeg x264 encoding settings [duplicate]
11 décembre 2014, par AndyThis question already has an answer here:
I want to set the x264 encoding settings via FFMPEG C++ SDK, how can I set it?
Now, I use the
av_opt_set
function but it seems not work. (ex.av_opt_set(c->priv_data, "cabac", "0", 0);
)I want to set the settings in below.
cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 G...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=0 weightp=0 keyint=1 keyint_minG...=1 scenecut=40 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Does anybody know?