i'm using zeranoe FFmpeg Build Version: 2a8dadb (2016-07-01)
my script : ffmpeg -i c:\AVerRecord170702a.avi -vcodec libx264 -preset veryslow -b:v 6000k -maxrate 6000k -bufsize 145000k -profile:v high -level 4.1 -an AVerRecord170702b.mp4
i'm getting this below error when i try to convert avi to mp4
where am i going wrong? please help.
+ Reply to Thread
Results 1 to 25 of 25
Your source is 4:2:2.
High Profile doesn't support 4:2:2 encoding, only the "regular" 4:2:0 subsampling
If you want to encode 4:2:2 , use high422 (ie. "-profile:v high422")
Or convert it to 4:2:0 (e.g. -pix_fmt yuv420p) , but if you have interlaced material it needs to use interlace scaling, and you should be using interlaced encoding
i'm using interlaced video what must i do
Either encode interlaced, or the other option is bob deinterlace it to 50p e.g use yadif or something
To encode interlaced in ffmpeg libx264 ,add -flags +ildct+ilme -x264opts tff=1
(I'm assuming it's TFF, 99.99% of HD video should be TFF if interlaced)
add also interlaced=1 to x264 options line, side to this you may think on converting 4:2:2 to 4:2:0 if your goal is consumer players compatibility.
If source is not interlaced but should be encoded as interlaced you can guide x264 to use false (fake) interlace.
It will be easier to advise if you can share some sample and describe your goal (for example what kind of player will be used to play such video).
i used this script:
ffmpeg -i C:\AVerRecord172629.avi -pix_fmt yuv420p -bf 3 -c:v libx264 -preset veryslow -b:v 6000k -maxrate 14000k -bufsize 14500k -profile:v high -level 4.1 -flags +ildct+ilme -x264opts tff=1 -qmin 4 -subq 9 -me_method hex -an AVerRecord172629a.mp4
i'm having dropping of frames
It doesn't report any dropped frames and the time is basically the same. 1:03.44 vs. 01:03.36. The difference is probably the timebase calculation
You also need to use interlaced scaling because the U,V planes are resized wihen you go from 4:2:2 to 4:2:0 and are keeping interlace. Otherwise you'll get chroma "ghosting"
sorry, i mean the video is jerking/flicking when I play in mpc-h
first i used this script
ffmpeg -i c:\AVerRecord170702a.avi -pix_fmt yuv420p -codec:v libx264 -preset veryslow -profile:v high -level 4.1 -b:v 6000k -maxrate 14000k -bufsize 14500k -bf 3 -flags +ildct+ilme -x264opts tff=1 -subq 9 -vf scale=w=-1:h=-1:interl=1 -an m:\AVerRecord170702b.mp4
and I used this
ffmpeg -i c:\AVerRecord170702a.avi -pix_fmt yuv420p -codec:v libx264 -preset veryslow -profile:v high -level 4.1 -b:v 6000k -maxrate 14000k -bufsize 14500k -bf 3 -flags +ildct+ilme -x264opts tff=1 -me_method umh -me_range 24 -subq 9 -vf scale=w=-1:h=-1:interl=1 -an m:\AVerRecord170702b.mp4
both was jerking.
Last edited by yukukuhi; 3rd Jul 2016 at 04:35.
If it's interlaced, you have to activate a deinterlacer on playback. If it's jerking fwd/back, then that suggests wrong field order (bottom field first, instead of top field first)
It's a YUY2 uncompressed capture of something? of What ? Is it possible you have dropped frames in the capture ?
Post a sample of the source with steady motion, but zip it up (archive it with zip or rar) . You can cut a sample with vdub, in direct stream copy mode. Also post a sample if the encode. You can copy a section to cut with avidemux (in copy mode)
It will be highly practical to knows answer for those question before advising you something to solve your problem - currently this is waste of time as obviously something not work and your source is not common as it use 4:2:2 - as such it may be anything even incorrect capture (wrong field order etc).
Provide sample - 5 - 10 seconds will be enough and information what kind of player you wish to use to play (if consumer not PC then it may not support anything above 4:2:0).
hi poisondeathray can i send the video through cloud link
hi pandy i'm recording interlaced footage with tuner box, i want it to play both on pc and bluray players.
You need to set encoder for bluedisk compatibility (some limitations in h.264 syntax are mandatory for BD compatibility), at the same time color matrix mst be changed from 601 to 709.
I assume your source is 4:2:0 so no significant loss when going back to 4:2:0 from 4:2:2.
To confirm all this some small sample of the video will be nice to have. Use VirtualDub and select part with lot of motion - relatively short to avoid large file size, you may use lossless codec (huffyouv, ffv1) to further reduce file size.
Btw unless you really need particular bitrate it is better to use crf mode instead bitrate especially with such weird constrains.
You max bitrate shall be maximum defined by profile and level unless you use some media that impose bitrate limitations (network, radio transmission etc).
my source is Hd,
i attached the video like you said i used utvideo lossless codec and
also here is the media info of the raw file
Complete name : C:\Users\Gankum\Videos\ AVerRecord170702ab.avi
Format : AVI
Format/Info : Audio Video Interleave
File size : 1.31 GiB
Duration : 13 s 560 ms
Overall bit rate : 831 Mb/s
ID : 0
Format : YUV
Codec ID : YUY2
Codec ID/Info : YUV 4:2:2 as for UYVY but with different component ordering within the u_int32 macropixel
Duration : 13 s 560 ms
Bit rate : 829 Mb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 25.000 FPS
Color space : YUV
Chroma subsampling : 4:2:2
Compression mode : Lossless
Bits/(Pixel*Frame) : 16.000
Stream size : 1.31 GiB (100%)
Last edited by yukukuhi; 5th Jul 2016 at 00:31.
I didn't see anything wrong with the source that would cause "jerking". Source content is progressive, not interlaced, if you've encoded it correctly with utvideo (maybe some other things were inadvertently done in between, that's why I asked for the original YUY2 source zipped up)
You didn't include an encoded version.
Are you using the word "jerking" correctly? Can you describe it in different words, maybe there is a miscommunication ?
You said it's "jerking" in mpchc. Can you try another player eg. potplayer, smplayer, vlc etc.. how does it play there ?
This one should work OK - quality (and overall bitrate) is set trough crf value - 18 should be OK for most of situations:
@SET x264opts="crf=18:vbv_maxrate=20000:vbv_bufsize=20000:level=4.0:keyint=250:qpmin=4:cabac=1:threads=auto:sliced_threads=0:slices=-1:tff=1:interlaced=0:fake-interlaced=1:no_psnr=1:no_ssim=1:bluray_compat=1:open-gop=0:pic_struct=1:aud=1:nal_hrd=vbr:force_cfr=1:fullrange=off:overscan=show:colorprim=bt709:transfer=bt709:colormatrix=bt709" @ffmpeg.exe -y -hide_banner -loglevel 32 -stats -color_range 2 -i "%1" -c:v libx264 -preset veryslow -tune film -profile:v high -level:v 4.0 -x264opts %x264opts% -x264-params %x264opts% -color_range 2 -vf "scale=iw:ih:sws_flags=neighbor:sws_dither=none:in_range=1:out_range=1,format=pix_fmts=yuv420p" -an -sn -movflags faststart -y -f mp4 "%~n1_vmo.mp4"
Maybe those 3 lines will be better - set limited to local instance:
@setlocal @set x264opts="crf=18:vbv_maxrate=20000:vbv_bufsize=20000:level=4.0:keyint=250:qpmin=4:cabac=1:threads=auto:sliced_threads=0:slices=-1:tff=1:interlaced=0:fake-interlaced=1:no_psnr=1:no_ssim=1:bluray_compat=1:open-gop=0:pic_struct=1:aud=1:nal_hrd=vbr:force_cfr=1:fullrange=off:overscan=show:colorprim=bt709:transfer=bt709:colormatrix=bt709" @ffmpeg.exe -y -hide_banner -loglevel 32 -stats -color_range 2 -i "%1" -c:v libx264 -preset veryslow -tune film -profile:v high -level:v 4.0 -x264opts %x264opts% -x264-params %x264opts% -color_range 2 -vf "scale=iw:ih:sws_flags=neighbor:sws_dither=none:in_range=1:out_range=1,format=pix_fmts=yuv420p" -an -sn -movflags faststart -y -f mp4 "%~n1_vmo.mp4"
Last edited by pandy; 5th Jul 2016 at 13:04.
-b:v 6000k -maxrate 6000k -bufsize 145000k -profile:v high -level 4.1
-b:v 6000k set video bitrate 6Mbps this is OK but not optimal as unless need to do transmission over limited bandwidth (or use limited storage) more important is video quality as such i proposed crf instead bitrate.
-maxrate 6000k same as above but even more suboptimal - unless you transmission bandwidth or unique storage bandwidth limitation max bitrate shall be limited only by profile itself.
-bufsize 145000k is IMHO not in-line with HW limitations in most of HW players - generally there is recommendation that buffer size should be somewhere around 1 sec to perhaps maximum equal gop length in seconds (so gop in frames / by framerate)
-level 4.1 i usually limit level to 4.0 - some older HW may have problems with 4.1
ok, and about the interlace commands.
tff=1:interlaced=0:fake-interlaced=1:bluray_compat=1Enable interlaced mode (top field first)
fake-interlaced=1Flag stream as interlaced but encode progressive. Makes it possible to encode 25p and 30p Blu-Ray streams. Ignored in interlaced mode.Enable compatibility hacks for Blu-ray support
lastly could you explain these commands please, it would be a great help of you in my learning, and thank you very much.
-vf "scale=iw:ih: sws_flags=neighbour:sws_dither=none:in_range=1:out _range=1
-movflags faststart -y -f mp4 "%~n1_vmo.mp4"
-y -hide_banner -loglevel 32 -stats -color_range 2
Last edited by yukukuhi; 8th Jul 2016 at 11:06.
ffmpeg to keep fullscale video at the input and at the output - ffmpeg can be tricky and it is not easy to keep level untouched so this is a bit overkill but it works nicely.
Run a second pass moving the index (moov atom) to the beginning of the file. This operation can take a while, and will not work in various situations such as fragmented output, thus it is not enabled by default.
%~n1_vmo.mp4 create new file with name of input file with added _vmo so if input file is for example xxx.avi output file will be xxx_vmo.mp4
http://www.chaneru.com/Roku/HLS/X264_Settings.htm#pic-struct , http://www.chaneru.com/Roku/HLS/X264_Settings.htm#aud , http://www.chaneru.com/Roku/HLS/X264_Settings.htm#nal-hrd , http://www.chaneru.com/Roku/HLS/X264_Settings.htm#force-cfr , fullrange off means that video has limited quantization range (good h.264 decoder will use this information) , overscan=show - check this one - generally it guide decoder to display full video with overscan.
All those options are usually good for all kind of HW decoders and they usually not hurt quality/compressibility so why not.
Last edited by pandy; 9th Jul 2016 at 06:24.
actually is my original footage's are interlaced or progressive..?