Newest 'x264' Questions - Stack Overflow
Les articles publiés sur le site
-
FFmpeg CRF control using x264 vs libvpx-vp9
19 octobre 2016, par igonI have some experience using ffmpeg with x264 and I wanted to do a comparison with libvpx-vp9. I tested a simple single pass encoding of a raw video, varying the crf settings and presets both with x264 and libvpx-vp9. I am new to libvpx and I followed this and this carefully but I might have still specified wrong combination of parameters since the results I get do not make much sense to me.
For x264 I did:
ffmpeg -i test_video.y4m -c:v libx264 -threads 1 -crf
-preset -y output.mkv and obtained the following results:
codec , settings , time , PSNR ,bitrate libx264,['-crf', '20', '-preset', 'fast'],13.1897280216, 42.938337 ,15728 libx264,['-crf', '20', '-preset', 'medium'],16.80494689, 42.879753 ,15287 libx264,['-crf', '20', '-preset', 'slow'],25.1142120361, 42.919206 ,15400 libx264,['-crf', '30', '-preset', 'fast'],8.79047083855, 37.975141 ,4106 libx264,['-crf', '30', '-preset', 'medium'],9.936599016, 37.713778 ,3749 libx264,['-crf', '30', '-preset', 'slow'],13.0959510803, 37.569511 ,3555
This makes sense to me, given a crf value you get a value of PSNR and changing the preset can decrease the bitrate but increase the time to encode.
For libvpx-vp9 I did:
ffmpeg -i test_video.y4m -c:v libvpx-vp9 -threads 1 -crf
-cpu-used -y output.mkv First of all I thought from tutorials online that the
-cpu-used
option is equivalent to-preset
in x264. Is that correct? If so what is the difference with-quality
? Furthermore since the range goes from -8 to 8 I assumed that negative values where the fast options while positive values the slowest. Results I get are very confusing though:codec , settings , time , PSNR ,bitrate libvpx-vp9,['-crf', '20', '-cpu-used', '-2'],19.6644911766,32.54317,571 libvpx-vp9,['-crf', '20', '-cpu-used', '0'],176.670887947,32.69899,564 libvpx-vp9,['-crf', '20', '-cpu-used', '2'],20.0206270218,32.54317,571 libvpx-vp9,['-crf', '30', '-cpu-used', '-2'],19.7931578159,32.54317,571 libvpx-vp9,['-crf', '30', '-cpu-used', '0'],176.587754965,32.69899,564 libvpx-vp9,['-crf', '30', '-cpu-used', '2'],19.8394429684,32.54317,571
Bitrate is very low and PSNR seems unaffected by the
crf
setting (and very low compared to x264). The-cpu-used
setting has very minimal impact and also seems that -2 and 2 are the same option.. What am I missing? I expected libvpx to take more time to encode (which is definitely true) but at the same time higher quality transcodes. What parameters should I use to have a fair comparison with x264?Edit: Thanks to @mulvya and this doc I figured that to work in crf mode with libvpx I have to add
-b:v 0
. I re-ran my tests and I get:codec , settings , time , PSNR ,bitrate libvpx-vp9,['-crf', '20', '-b:v', '0', '-cpu-used', '-2'],57.6835780144,45.111158,17908 libvpx-vp9,['-crf', '20', '-b:v', '0', '-cpu-used', '0'] ,401.360313892,45.285367,17431 libvpx-vp9,['-crf', '20', '-b:v', '0', '-cpu-used', '2'] ,57.4941239357,45.111158,17908 libvpx-vp9,['-crf', '30', '-b:v', '0', '-cpu-used', '-2'],49.175855875,42.588178,11085 libvpx-vp9,['-crf', '30', '-b:v', '0', '-cpu-used', '0'] ,347.158324957,42.782194,10935 libvpx-vp9,['-crf', '30', '-b:v', '0', '-cpu-used', '2'] ,49.1892938614,42.588178,11085
PSNR and bitrate went up significantly by adding
-b:v 0
-
Setting EBP data via FFMPEG
14 octobre 2016, par user2475310With FFMPEG can we insert EBP data on certain frames? If so what is the command?
We have IDR frames that must have EPB data.
-
Does libx265 and libx264 libraries implement a decoder ?
10 octobre 2016, par KevinoI have one question about these 2 codec library developped by videolan.
Does x265(libx265) implements a decoder? Same question for x264(libx264).
Thank you for your answers.
-
How does one encode a series of images into H264 using the x264 C API ?
23 septembre 2016, par RellaHow does one use the x264 C API to encode RBG images into H264 frames? I already created a sequence of RBG images, how can I now transform that sequence into a sequence of H264 frames? In particular, how do I encode this sequence of RGB images into a sequence of H264 frame consisting of a single initial H264 keyframe followed by dependent H264 frames?
-
Issue with openh264enc gstreamer plugin and tcp connections
20 septembre 2016, par agaldosI am trying to stream over TCP encoded video into a EC2 Instance. Using "x264enc" encoder, all works correctly. I get the frames and generate the video correctly.
The issue comes when I try to use the "openh264enc" encoder.
If I put in the server "nc -l -p 5555" I can check that data is arriving into the port but when I put the pipeline goes to PREROLLING state and nothing more happens. If I cut the process in the sender, this message appears in the server:
ubuntu@ip-172-31-87-56:~$ gst-launch-1.0 -e -v tcpserversrc host=ec2-52-29-128-23.eu-central-1.compute.amazonaws.com port=5555 ! h264parse ! mpegtsmux ! filesink location=file.ts Setting pipeline to PAUSED ... /GstPipeline:pipeline0/GstTCPServerSrc:tcpserversrc0: current-port = 5555 Pipeline is PREROLLING ... ERROR: from element /GstPipeline:pipeline0/GstH264Parse:h264parse0: No valid frames found before end of stream Additional debug info: gstbaseparse.c(1281): gst_base_parse_sink_event_default (): /GstPipeline:pipeline0/GstH264Parse:h264parse0 ERROR: pipeline doesn't want to preroll. Setting pipeline to NULL ... /GstPipeline:pipeline0/GstTCPServerSrc:tcpserversrc0: current-port = 0 Freeing pipeline ...
Pipeline used in the EC2 Instance, the server:
gst-launch-1.0 -e -v tcpserversrc host=ec2-52-29-128-23.eu-central-1.compute.amazonaws.com port=5555 ! h264parse ! mpegtsmux ! filesink location=file.ts
Sender pipeline with x264enc:
gst-launch-1.0 -e videotestsrc horizontal-speed=5 ! x264enc ! tcpclientsink port=5555 host=52.29.128.23
Sender pipeline with openh264enc:
gst-launch-1.0 -e videotestsrc horizontal-speed=5 ! openh264enc ! tcpclientsink port=5555 host=52.29.128.23