VideoHelp Forum
+ Reply to Thread
Results 1 to 25 of 25
Thread
  1. Member
    Join Date
    May 2016
    Location
    India
    Search Comp PM
    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

    Click image for larger version

Name:	ff.jpg
Views:	1057
Size:	242.0 KB
ID:	37579

    where am i going wrong? please help.
    Quote Quote  
  2. 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
    Quote Quote  
  3. Member
    Join Date
    May 2016
    Location
    India
    Search Comp PM
    i'm using interlaced video what must i do
    Quote Quote  
  4. Originally Posted by yukukuhi View Post
    i'm using interlaced video what must i do
    You have to decide . It depends on the background information, why you are doing this, what scenario, what target(s) etc...

    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)
    Quote Quote  
  5. 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).
    Quote Quote  
  6. Member
    Join Date
    May 2016
    Location
    India
    Search Comp PM
    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

    Click image for larger version

Name:	Untitled.jpg
Views:	425
Size:	595.4 KB
ID:	37594

    i'm having dropping of frames
    Quote Quote  
  7. Originally Posted by yukukuhi View Post
    i'm having dropping of frames
    Clarify what you mean by this ?

    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"
    Code:
    -vf scale=w=-1:h=-1:interl=1
    Quote Quote  
  8. Member
    Join Date
    May 2016
    Location
    India
    Search Comp PM
    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.
    Quote Quote  
  9. 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)
    Quote Quote  
  10. Originally Posted by yukukuhi View Post
    sorry, i mean the video is jerking/flicking when I play in mpc-h

    both was jerking.
    Why you refuse to answer simple questions like what is target player, what kind of source you have?
    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).
    Quote Quote  
  11. Member
    Join Date
    May 2016
    Location
    India
    Search Comp PM
    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.
    Quote Quote  
  12. Originally Posted by yukukuhi View Post
    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.
    Is your source is SD? If yes then best option is deinterlace source and upscaling it to 720p then encoding as progressive with doubled number of frames.
    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).
    Quote Quote  
  13. Member
    Join Date
    May 2016
    Location
    India
    Search Comp PM
    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

    General
    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

    Video
    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%)
    Image Attached Files
    Last edited by yukukuhi; 5th Jul 2016 at 00:31.
    Quote Quote  
  14. 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 ?
    Quote Quote  
  15. Member
    Join Date
    May 2016
    Location
    India
    Search Comp PM
    hi here is the original YUY2 source and the encoded file zipped up

    in vlc it's playing nicely.
    Image Attached Files
    Quote Quote  
  16. This one should work OK - quality (and overall bitrate) is set trough crf value - 18 should be OK for most of situations:

    Code:
    @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"
    Quote Quote  
  17. Member
    Join Date
    May 2016
    Location
    India
    Search Comp PM
    in what order i must type the commands in ffmpeg please help

    i'm new to ffmpeg and i only started to learn a few weeks ago.
    Quote Quote  
  18. Originally Posted by yukukuhi View Post
    in what order i must type the commands in ffmpeg please help

    i'm new to ffmpeg and i only started to learn a few weeks ago.
    Copy those 2 lines to notepad and save with name you like, extension should be cmd or bat - that's all (drag and drop video file on it), this is only for video so i assume you processing audio in a different way.

    --

    Maybe those 3 lines will be better - set limited to local instance:

    Code:
    @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.
    Quote Quote  
  19. Member
    Join Date
    May 2016
    Location
    India
    Search Comp PM
    it playbacks fine now in mpc-h and vlc,

    what was i doing wrong in my script could you explain i want to learn please,

    and thanks
    Quote Quote  
  20. Originally Posted by yukukuhi View Post
    it playbacks fine now in mpc-h and vlc,

    what was i doing wrong in my script could you explain i want to learn please,

    and thanks
    Not sure if this help you but
    Code:
     -b:v 6000k -maxrate 6000k -bufsize 145000k -profile:v high -level 4.1
    IMHO is suboptimal as:
    -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
    Quote Quote  
  21. Member
    Join Date
    May 2016
    Location
    India
    Search Comp PM
    ok, and about the interlace commands.
    Quote Quote  
  22. Originally Posted by yukukuhi View Post
    ok, and about the interlace commands.
    Code:
    tff=1:interlaced=0:fake-interlaced=1:bluray_compat=1
    tff=1
    Enable interlaced mode (top field first)
    interlaced=0 not interlaced (opposite to above but having this in one line allow me to switch easily progressive vs interlaced encoding)

    fake-interlaced=1
    Flag stream as interlaced but encode progressive. Makes it possible to encode 25p and 30p Blu-Ray streams. Ignored in interlaced mode.
    bluray_compat=1
    Enable compatibility hacks for Blu-ray support
    Goal of those switches is to produce HW decoders compatible video - HW decoders are way more limited than software and they request particular constrains - all those switches in theory make possible to create video that will be decoded by everything.
    Quote Quote  
  23. Member
    Join Date
    May 2016
    Location
    India
    Search Comp PM
    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"

    no_psnr=1:no_ssim=1:bluray_compat=1:open-gop=0:pic_struct=1:aud=1:nal_hrd=vbr:force_cfr=1:f ullrange=off:overscan=show:

    -y -hide_banner -loglevel 32 -stats -color_range 2
    Last edited by yukukuhi; 8th Jul 2016 at 11:06.
    Quote Quote  
  24. Originally Posted by yukukuhi View Post
    lastly could you explain these commands please, it would be a great help of you in my learning, and thank you very much.
    no problemo

    Originally Posted by yukukuhi View Post
    Code:
    -vf "scale=iw:ih: sws_flags=neighbour:sws_dither=none:in_range=1:out_range=1
    this force 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.

    Originally Posted by yukukuhi View Post
    Code:
     -movflags faststart -y -f mp4 "%~n1_vmo.mp4"
    flag movstart is recommended by YouTube
    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.
    -f mp4 explicitly select container mp4 (bit overkill but ffmpeg can be tricky - prefer to explicitly control it)

    %~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

    Originally Posted by yukukuhi View Post
    Code:
    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:
    
     -y -hide_banner -loglevel 32 -stats -color_range 2
    i disable PSNR and SSIM calculation in x264 - not interested in those numbers at all, forcing bluray compatibility, closed gop, 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.
    Quote Quote  
  25. Member
    Join Date
    May 2016
    Location
    India
    Search Comp PM
    actually is my original footage's are interlaced or progressive..?
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!