VideoHelp Forum
+ Reply to Thread
Results 1 to 14 of 14
Thread
  1. Member
    Join Date
    Aug 2010
    Location
    Gliese 581 g
    Search PM
    Hello, I have been having an issue with FFMPEG hanging when encoding .avs files to mp4 or huffyuv. It will just stall on a random frame. This could be 8000 or 35,000. Each time I eventually get it to work with one setting, that setting never works the next time.

    For instance, All of these settings worked only once, then failed when used again:
    ffmpeg -i VW014.avs -c:a mp3 -qscale:a 0 -c:v libx264 -flags +ilme+ildct -preset slower -crf 18 -profile:v high422 -pix_fmt yuv422p -tune grain -vf setfield=bff -nostdin VW014Broadcast_Interlaced_FINAL.mp4

    ffmpeg -i VW014.avs -c:a mp3 -qscale:a 0 -c:v libx264 -preset slower -crf 18 -profile:v high422 -pix_fmt yuv422p -tune grain -vf setfield=bff -nostdin VW014Broadcast_Interlaced_FINAL.mp4

    ffmpeg -i VW014.avs -c:a mp3 -qscale:a 0 -c:v libx264 -preset slower -crf 18 -profile:v high422 -tune grain -nostdin VW014.mp4

    This failed at frame 20295:
    ffmpeg -i VW014.avs -c:a mp3 -qscale:a 0 -c:v libx264 -preset slower -crf 18 -profile:v high422 -pix_fmt yuv422p -tune grain -nostdin VW014_YT_Progressive.mp4

    This worked once:
    ffmpeg -i VW014.avs -c:a mp3 -qscale:a 0 -c:v libx264 -flags +ilme+ildct -preset slower -crf 18 -profile:v high422 -vf setfield=bff -nostdin VW014Broadcast_Interlaced_FINAL.mp4

    Then the next time, failed at Frame 8999
    ffmpeg -i VW015.avs -c:a mp3 -qscale:a 0 -c:v libx264 -flags +ilme+ildct -preset slower -crf 18 -profile:v high422 -vf setfield=bff -nostdin VW015Broadcast_Interlaced_FINAL.mp4

    Here is example of full output that failed:

    ffmpeg -i VW015.avs -c:a mp3 -qscale:a 0 -c:v libx264 -flags +ilme+ildct -preset slower -crf 18 -profile:v high422 -nostdin VW015Broadcast_Interlaced_FINAL.mp4

    Input #0, avisynth, from 'VW015.avs':
    Duration: 00:28:21.83, start: 0.000000, bitrate: 0 kb/s
    Stream #0:0: Video: rawvideo (Y42B / 0x42323459), yuv422p(tv), 720x480, 29.97 fps, 29.97 tbr, 29.97 tbn
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
    Stream mapping:
    Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
    Stream #0:1 -> #0:1 (pcm_s16le (native) -> mp3 (libmp3lame))
    [libx264 @ 000002821c449300] interlace + weightp is not implemented
    [libx264 @ 000002821c449300] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
    [libx264 @ 000002821c449300] profile High 4:2:2, level 3.1, 4:2:2, 8-bit
    [libx264 @ 000002821c449300] 264 - core 164 r3172 c1c9931 - H.264/MPEG-4 AVC codec - Copyleft 2003-2023 - http://www.videolan.org/x264.html - options: cabac=1 ref=8 deblock=1:0:0 analyse=0x3:0x133 me=umh subme=9 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=15 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=tff bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=0 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=60 rc=crf mbtree=1 crf=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'VW015Broadcast_Interlaced_FINAL.mp4':
    Metadata:
    encoder : Lavf60.16.100
    Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv422p(tv, progressive), 720x480, q=2-31, 29.97 fps, 30k tbn
    Metadata:
    encoder : Lavc60.31.102 libx264
    Side data:
    cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
    Stream #0:1: Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, stereo, s16p
    Metadata:
    encoder : Lavc60.31.102 libmp3lame
    frame=39635 fps= 11 q=24.0 size= 734720kB time=00:22:05.01 bitrate=4542.5kbits/s speed=0.366x

    I used -nostdin because I read that may help when FFMPEG expects the buffers to be read. Fixed the issue once, but that's it. Thanks for any advice.
    Quote Quote  
  2. post your script
    Quote Quote  
  3. Member
    Join Date
    Aug 2010
    Location
    Gliese 581 g
    Search PM
    Thanks, this is the most recent one having trouble, which is simple:

    Code:
    Import("C:\Program Files (x86)\AviSynth+\plugins64+\ReplaceFramesMC2_AD.avsi")
    
    video = AVISource("D:\VW015.avi")
    
    last = video.ConvertToYV16(matrix="Rec601",interlaced=True)
    
    ReplaceFramesMC2_AD(last, 30486, 4)
    ReplaceFramesMC2_AD(last, 30491, 2)
    ReplaceFramesMC2_AD(last, 30499, 4)
    
    #at end
    ReplaceFramesMC2_AD(last, 49694, 7)
    ReplaceFramesMC2_AD(last, 49711, 9)
    ReplaceFramesMC2_AD(last, 49734, 7)
    ReplaceFramesMC2_AD(last, 49754,6)
    ReplaceFramesMC2_AD(last, 49773, 9)
    ReplaceFramesMC2_AD(last, 49790, 10)
    
    
    AssumeBFF().nnedi3(field=-2)
    
    
    #removes strip on left side
    no_stripe =last.DeStripe(2,1,80).Crop(0,0,30,0)
    last = Layer(last, no_stripe, op="add")
    
    
    #center image part 1 to save processing time (no need to apply filters to black areas)
    Crop(8,8,-8,-12)
    
    RemoveDirtSMC(55).RemoveDirtSMC(25)
    FFT3DFilter(sigma=2, bt=5)
    smoothuv2(radius=3,interlaced=0)
    
    AddBorders(8,8,8,12)
    
    AssumeBFF().SeparateFields().SelectEvery(4,0,3).Weave()
    
    AddGrainC(var=5)
    
    return last
    Quote Quote  
  4. Banned
    Join Date
    Nov 2023
    Location
    Europe
    Search Comp PM
    Originally Posted by Winsordawson View Post
    Hello, I have been having an issue with FFMPEG hanging when encoding .avs files to mp4 or huffyuv. It will just stall on a random frame. This could be 8000 or 35,000. Each time I eventually get it to work with one setting, that setting never works the next time.

    For instance, All of these settings worked only once, then failed when used again:
    ffmpeg -i VW014.avs -c:a mp3 -qscale:a 0 -c:v libx264 -flags +ilme+ildct -preset slower -crf 18 -profile:v high422 -pix_fmt yuv422p -tune grain -vf setfield=bff -nostdin VW014Broadcast_Interlaced_FINAL.mp4

    ffmpeg -i VW014.avs -c:a mp3 -qscale:a 0 -c:v libx264 -preset slower -crf 18 -profile:v high422 -pix_fmt yuv422p -tune grain -vf setfield=bff -nostdin VW014Broadcast_Interlaced_FINAL.mp4

    ffmpeg -i VW014.avs -c:a mp3 -qscale:a 0 -c:v libx264 -preset slower -crf 18 -profile:v high422 -tune grain -nostdin VW014.mp4

    This failed at frame 20295:
    ffmpeg -i VW014.avs -c:a mp3 -qscale:a 0 -c:v libx264 -preset slower -crf 18 -profile:v high422 -pix_fmt yuv422p -tune grain -nostdin VW014_YT_Progressive.mp4

    This worked once:
    ffmpeg -i VW014.avs -c:a mp3 -qscale:a 0 -c:v libx264 -flags +ilme+ildct -preset slower -crf 18 -profile:v high422 -vf setfield=bff -nostdin VW014Broadcast_Interlaced_FINAL.mp4

    Then the next time, failed at Frame 8999
    ffmpeg -i VW015.avs -c:a mp3 -qscale:a 0 -c:v libx264 -flags +ilme+ildct -preset slower -crf 18 -profile:v high422 -vf setfield=bff -nostdin VW015Broadcast_Interlaced_FINAL.mp4

    Here is example of full output that failed:

    ffmpeg -i VW015.avs -c:a mp3 -qscale:a 0 -c:v libx264 -flags +ilme+ildct -preset slower -crf 18 -profile:v high422 -nostdin VW015Broadcast_Interlaced_FINAL.mp4

    Input #0, avisynth, from 'VW015.avs':
    Duration: 00:28:21.83, start: 0.000000, bitrate: 0 kb/s
    Stream #0:0: Video: rawvideo (Y42B / 0x42323459), yuv422p(tv), 720x480, 29.97 fps, 29.97 tbr, 29.97 tbn
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
    Stream mapping:
    Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
    Stream #0:1 -> #0:1 (pcm_s16le (native) -> mp3 (libmp3lame))
    [libx264 @ 000002821c449300] interlace + weightp is not implemented
    [libx264 @ 000002821c449300] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
    [libx264 @ 000002821c449300] profile High 4:2:2, level 3.1, 4:2:2, 8-bit
    [libx264 @ 000002821c449300] 264 - core 164 r3172 c1c9931 - H.264/MPEG-4 AVC codec - Copyleft 2003-2023 - http://www.videolan.org/x264.html - options: cabac=1 ref=8 deblock=1:0:0 analyse=0x3:0x133 me=umh subme=9 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=15 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=tff bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=0 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=60 rc=crf mbtree=1 crf=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'VW015Broadcast_Interlaced_FINAL.mp4':
    Metadata:
    encoder : Lavf60.16.100
    Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv422p(tv, progressive), 720x480, q=2-31, 29.97 fps, 30k tbn
    Metadata:
    encoder : Lavc60.31.102 libx264
    Side data:
    cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
    Stream #0:1: Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, stereo, s16p
    Metadata:
    encoder : Lavc60.31.102 libmp3lame
    frame=39635 fps= 11 q=24.0 size= 734720kB time=00:22:05.01 bitrate=4542.5kbits/s speed=0.366x

    I used -nostdin because I read that may help when FFMPEG expects the buffers to be read. Fixed the issue once, but that's it. Thanks for any advice.
    This happend to me one time, inside the command prompt where you see theese things during the encoding "frame=39635 fps= 11 q=24.0 size= 734720kB time=00:22:05.01 bitrate=4542.5kbits/s speed=0.366x".. i pressed enter and the process continued and completed eventually! it didnt give any error message or such! if it just look like it have stopped/paused the proccess, it worked with pressing enter, allso you could try increase the process priority for the future or try clear up some more free ram memory by turning of some programs thats not needed during the encoding!
    Quote Quote  
  5. Member
    Join Date
    Aug 2010
    Location
    Gliese 581 g
    Search PM
    Thanks, from what I recall pressing Enter did nothing but I will run it again and see. Could it be from anything in my script?
    Quote Quote  
  6. Banned
    Join Date
    Nov 2023
    Location
    Europe
    Search Comp PM
    Originally Posted by Winsordawson View Post
    Thanks, from what I recall pressing Enter did nothing but I will run it again and see. Could it be from anything in my script?
    Yeah give it an try, it worked for me atleast, to my surprise, and i still wasnt sure why it started stopping/pausing, only thing i recall was different from normal was a bit more used ram memory and allso the computer had been doing alot of stuff lately so probably the windows cache or something similar was more full then normal!

    I have never used AviSynth, atleast not yet but with the Avanti GUI + FFMpeg Essentials v.6.0 gave some sort of message about the initialized FFMpeg beeing AviSynth compitable or something, so it had me a lil bit interested, to me it looked allright atleast but on the other side i dont really know what is good or bad either when it come to AviSynth!

    Edit: Well now when i took an look at it again you see the "+" in the path name there, some programs dont really like the weird type of letters sometimes such as +, , , and so on!
    Last edited by Swedaniel; 25th Jan 2024 at 19:58.
    Quote Quote  
  7. All those motion compensated filters in AviSynth are probably the source of the problem. What version of AviSynth are you using? I would recommend 64 bit AviSynth+ these days. Don't set the prefetch value too high.
    Quote Quote  
  8. Do you have old version of AVSTP in plugins directory ? It can cause hanging on random frames. Upgrade if you do

    https://github.com/pinterf/AVSTP/releases
    Quote Quote  
  9. Member
    Join Date
    Aug 2010
    Location
    Gliese 581 g
    Search PM
    Thanks for all the tips!

    Swedaniel--I tried running the script again and when it stalled I tried pressing Enter but nothing happened. The cursor would just continue to blink under the first character.

    jagabo--I am running 64 bit Avisynth+ 3.7.2. I never use Prefetch because I just never spent time looking into it.

    poisondeathray--Indeed, I did have an older version of AVSTP. I downloaded the new one and will re-run the script and let everyone know.
    Quote Quote  
  10. Member
    Join Date
    Aug 2018
    Location
    Wrocław
    Search PM
    Originally Posted by Winsordawson View Post
    Thanks, this is the most recent one having trouble, which is simple:

    Code:
    Import("C:\Program Files (x86)\AviSynth+\plugins64+\ReplaceFramesMC2_AD.avsi")
    
    video = AVISource("D:\VW015.avi")
    
    last = video.ConvertToYV16(matrix="Rec601",interlaced=True)
    
    ReplaceFramesMC2_AD(last, 30486, 4)
    ReplaceFramesMC2_AD(last, 30491, 2)
    ReplaceFramesMC2_AD(last, 30499, 4)
    
    #at end
    ReplaceFramesMC2_AD(last, 49694, 7)
    ReplaceFramesMC2_AD(last, 49711, 9)
    ReplaceFramesMC2_AD(last, 49734, 7)
    ReplaceFramesMC2_AD(last, 49754,6)
    ReplaceFramesMC2_AD(last, 49773, 9)
    ReplaceFramesMC2_AD(last, 49790, 10)
    I had the same thing when using ReplaceFramesRIFE -- I could safely use up to about 15 commands. Reduce yours and check if the problem still occurs.
    Use VirtualDub -- it allowed more Replace commands than ffmpeg.
    The fact that you also have other commands doesn't help the script
    Quote Quote  
  11. Member
    Join Date
    Aug 2010
    Location
    Gliese 581 g
    Search PM
    Thanks, but it has happened with scripts even when I don't use ReplaceFrames. I would use VirtualDub but it does not have all the options of FFMPEG, like the unique interlace encoding ildct, which cuts the file size down in half, nor the tune grain feature, which lets more grain come through even with an h.264 encoding, giving the illusion of more detail.
    Quote Quote  
  12. Member
    Join Date
    Aug 2018
    Location
    Wrocław
    Search PM
    Originally Posted by Winsordawson View Post
    Thanks, but it has happened with scripts even when I don't use ReplaceFrames. I would use VirtualDub but it does not have all the options of FFMPEG, like the unique interlace encoding ildct, which cuts the file size down in half, nor the tune grain feature, which lets more grain come through even with an h.264 encoding, giving the illusion of more detail.
    But in VirtualDub the conversion works ok? If so, Avisynth won't be a problem.
    Keep looking for the source of the problem - try a different version of ffmpeg (older, newer), recode to avi. Exclude one by one.
    Quote Quote  
  13. Try a different source filter in AviSynth.
    Quote Quote  
  14. Member
    Join Date
    Aug 2010
    Location
    Gliese 581 g
    Search PM
    Thanks for the tips. It seems that updating the AVSTP plugin may have fixed this, but I will keep in mind the other ideas if it continues. Are there any other plugins to update that could affect FFMPEG to prevent this from happening again?
    Quote Quote  



Similar Threads

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