Newest 'x264' Questions - Stack Overflow
Les articles publiés sur le site
-
ffmpeg conversion x264 [error] : malloc of size 769152 failed
4 octobre 2022, 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 is the FFMPEG x264 result bitrate calculated ?
12 septembre 2022, par secondplaceWhen encoding in x264 (libx264) there is a listing at the end showing different encoding stats. I noticed that the Bitrate is too high. I was wondering how this can be.
Here is an example:
frame=177719 fps= 24 q=-1.0 Lsize= 4768888kB time=02:03:35.74 bitrate=5268.1kbits/s dup=0 drop=43 speed=1.01x video:4186558kB audio:579355kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.062419%
From the first two result lines I can grab the stream size and stream duration. From that i can calculate the overall bitrate
(4186558 * 8) / 7415.744 = 4516.39970311812
However the last FFMPEG output shows an additional 108.4kb/s:
[libx264 @ 0000026e1011f440] kb/s:4624.79
When I use MediaInfo to get the stream size and stream duration it's also a little different.
(4192906.438 * 8) / 7415.742 = 4523.24952836817
The manual calculations from FFMPEG and MediaInfo are close enough and not significantly different however where are the 100kb/s+ from FFMPEG results coming from?
Edit:
I just found out that using
--parsespeed=1
in MediaInfo CLI will give more accurate results for Variable Bitrates. Default is0.5
. -
I B P frames order and relative time - ffmpeg recorded video not smooth (stuttering)
8 septembre 2022, par FrancescoI'm trying to understand why my recorded video is not smooth. I'm using a USB capture device and OBS/ffmpeg software. OBS Stats doesn't show any skipped/missed frames during recording.
Using this command on the resulting file (H264, mkv)
ffprobe -v quiet -pretty -print_format csv -show_entries "frame=coded_picture_number,pkt_pts,pkt_duration,pict_type," -select_streams v:0 test.mkv > output.csv
I see an output like this one:
frame,33,33,I,0 frame,67,33,P,1 frame,100,33,I,2 frame,133,33,I,3 frame,167,33,P,4 frame,200,33,I,5 frame,233,33,P,6 frame,267,33,I,7 frame,300,33,B,9 frame,333,33,P,8 frame,367,33,I,10 frame,400,33,P,11 frame,433,33,I,12 frame,467,33,B,14 frame,500,33,P,13 frame,533,33,I,15 frame,567,33,P,16 frame,600,33,I,17 frame,633,33,B,19 frame,667,33,P,18 frame,700,33,I,20 frame,733,33,B,22 frame,767,33,P,21 frame,800,33,I,23 frame,833,33,B,25 frame,867,33,P,24 frame,900,33,I,26 frame,933,33,B,28 frame,967,33,P,27 frame,1000,33,I,29 ...
If I understood correclty the last number refers to presentation order and the second number is the video relative time. Frame number 9 (type B) is shown at 300 ms while frame number 8 (type P) is shown at 333 ms.
Is it correct? If not, is this the stuttering source and is there a way for fixing the order?
-
How can i encode a video using a QP map in x264 ? [closed]
5 septembre 2022, par JustABeginnerI have a qp table contains x and y coordinates, poc and QP value of each block.
How can I change x264 source code so that I could encode a video with this table?
I tried using qpfile but its for each frame, not each blocks.
Hope someone could help me.
Here's the table I mentioned:
-
x264 : How to Correctly Use quant_offsets ?
25 août 2022, par EynnzerrSuppose I need to encode different regions with different QPs in one frame, i.e. RoI(regions of interest) encoding. I searched all over the internet and was only told that
quant_offsets
can meet my demand. However, none of them told me exactly how to use it, and I can't find any official documentation about it. I read the source code of x264 and did experiments, and find it only adds an offset to the qp decision x264 has made, rather than exactly set the qp value I want.Is there a possible way that I can have x264 encode these regions using the qp value I've explictly given instead of adding offsets based on what it decided on its own? Many thanks!