VideoHelp Forum

+ Reply to Thread
Results 1 to 24 of 24
Thread
  1. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    I have given up on ffplay but I mention it in case someone got it to work.

    It appears that VLC may be able to output to pipe, then I can input to FFMPEG for encode but I have yet to find the right combination of commands to make it happen.

    Has anyone been able to do this?

    Some odd files (often VOB) end up having issues when being read directly with FFMPEG, for whatever reason. However VLC will read it and play it perfectly so my thought was let VLC pipe it to FFMPEG.

    Win10/64

    Andrew
    Last edited by RogerTango; 1st Dec 2021 at 16:46.
    Quote Quote  
  2. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Here is what I have tried so far, mostly snippits from google searches, nothing seams to pass the stream via pipe to ffmpeg; successfully

    Code:
    rem vlc "%cd%/test.mpg" -vout=yuv --yuv-yuv4mpeg2 --yuv-file=/dev/stdout | ffmpeg_x64 -i - -r 23.976 -c:a libmp3lame -ac 2 -af "dynaudnorm,volume=6dB" -b:v 2500k -c:v h264_nvenc -preset medium -profile:v main -level:v 4 -vf "scale=1280:720:flags=lanczos4,hqdn3d" -pix_fmt yuv420p -aspect 16:9 -y "test.mp4"
    
    rem vlc "%cd%/test.mpg" --rawvid-chroma=YV12 --yuv-file=/dev/stdout | ffmpeg_x64 -i - -r 23.976 -c:a libmp3lame -ac 2 -af "dynaudnorm,volume=6dB" -b:v 2500k -c:v h264_nvenc -preset medium -profile:v main -level:v 4 -vf "scale=1280:720:flags=lanczos4,hqdn3d" -pix_fmt yuv420p -aspect 16:9 -y "test.mp4"
    
    rem vlc "%cd%/test.mpg" :sout=#transcode{vcodec=flv,vb=5024,fps=23.976,acodec=flv,ab=128,channels=2}:duplicate{dst=std{access=file,mux=ts,dst=-}} | ffmpeg_x64 -i - -r 23.976 -c:a libmp3lame -ac 2 -af "dynaudnorm,volume=6dB" -b:v 2500k -c:v h264_nvenc -preset medium -profile:v main -level:v 4 -vf "scale=1280:720:flags=lanczos4,hqdn3d" -pix_fmt yuv420p -aspect 16:9 -y "test.mp4"
    
    rem vlc "%cd%/test.mpg" --sout '#std{mux=ts,access=file,dst=-}' | ffmpeg_x64 -i - -r 23.976 -c:a libmp3lame -ac 2 -af "dynaudnorm,volume=6dB" -b:v 2500k -c:v h264_nvenc -preset medium -profile:v main -level:v 4 -vf "scale=1280:720:flags=lanczos4,hqdn3d" -pix_fmt yuv420p -aspect 16:9 -y "test.mp4"
    
    rem vlc "%cd%/test.mpg" -vvv --sout | ffmpeg_x64 -i - -r 23.976 -c:a libmp3lame -ac 2 -af "dynaudnorm,volume=6dB" -b:v 2500k -c:v h264_nvenc -preset medium -profile:v main -level:v 4 -vf "scale=1280:720:flags=lanczos4,hqdn3d" -pix_fmt yuv420p -aspect 16:9 -y "test.mp4"
    
    rem vlc loads, but never sends stream to ffmpeg, just sits there...  ffmpeg appears to be waiting on a stream so the chain appears to be "ok"
    rem vlc "%cd%/test.mpg" --sout - | ffmpeg_x64 -i - -r 23.976 -c:a libmp3lame -ac 2 -af "dynaudnorm,volume=6dB" -b:v 2500k -c:v h264_nvenc -preset medium -profile:v main -level:v 4 -vf "scale=1280:720:flags=lanczos4,hqdn3d" -pix_fmt yuv420p -aspect 16:9 -y "test.mp4"
    Quote Quote  
  3. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Spent 10 hours today at the keyboard. I finally figured it out.
    Quote Quote  
  4. So why don't you tell everyone what you did?
    Quote Quote  
  5. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Originally Posted by jagabo View Post
    So why don't you tell everyone what you did?

    Ill forward it by PM to everyone that responded in the thread that tried to help...
    Quote Quote  
  6. Member
    Join Date
    Aug 2006
    Location
    United States
    Search Comp PM
    It is likely that no one who saw your thread had the slightest idea of how to find a solution to your problem.
    Ignore list: hello_hello, tried, TechLord, Snoopy329
    Quote Quote  
  7. What were the original issues with "Some odd files (often VOB) end up having issues when being read directly with FFMPEG" ?

    (What is VLC doing that you can't do with ffmpeg directly using the correct switches ?)
    Quote Quote  
  8. Originally Posted by RogerTango View Post
    Originally Posted by jagabo View Post
    So why don't you tell everyone what you did?

    Ill forward it by PM to everyone that responded in the thread that tried to help...
    So why should anyone help you (in all your other threads) if you're not willing to help others? Selfish *******.
    Quote Quote  
  9. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Originally Posted by poisondeathray View Post
    What were the original issues with "Some odd files (often VOB) end up having issues when being read directly with FFMPEG" ?

    (What is VLC doing that you can't do with ffmpeg directly using the correct switches ?)
    1) Not very often, there would be some VOBs (I 100% hate this container!!) that would have A/V sync issues, etc that FFMPEG would not deal with,
    I would have to first do a quick scan fix with VideoRedo and THEN feed them to FFMPEG

    2) I was in hopes that since VLC seams to play these suspect VOBs without issue, then it would also be able to transcode them equally well.

    As I have found out, VLC does not do near as good a job at transcoding as FFMPEG/Handbrake/NVENC does, and is really limited to switches in the options, and options them selves.

    In addition, I have found that VLC's performance Vs. the 3 I mentioned, is pretty anemic.

    VLC did not resolve any of the issues I was dealing with. I got it to work, but project has been abandoned and retaining my current work flow.

    Ill post the code I got working a little later so if anyone wants to play with it, they can have at it. \-)


    I hope that helps.
    Quote Quote  
  10. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Originally Posted by jagabo View Post
    So why should anyone help you (in all your other threads) if you're not willing to help others? Selfish *******.
    Relax brother, I got in my feelings like a twat. Ill post the code a little later, have fun with it... its a waste of my time, performance and results did not justify the time invested.

    Andrew
    Quote Quote  
  11. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Code:
    vlc --no-repeat --no-loop -vv -I dummy "test.mpg"  --sout=#transcode{vcodec=HFYU,vb=10024,acodec=mp3,ab=192,channels=2}:standard{access=file,mux=mkv,dst=-} vlc://quit | ffmpeg_x64 -i - -r 23.976 -c:a libmp3lame -ac 2 -af "dynaudnorm,volume=6dB" -b:v 2500k -c:v h264_nvenc -preset medium -profile:v main -level:v 4 -vf "scale=1280:720,hqdn3d" -pix_fmt yuv420p -aspect 16:9 -y "test.mp4"
    ffmpeg_x64 is just renamed on my computer to assure I am using the 64 bit version Vs. the 32 bit version which is named; ffmpeg_x32
    Quote Quote  
  12. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    VLC can pipe directly to FFMPEG

    However, it cannot pipe directly to NVENC, you have to pipe:

    VLC -> FFMPEG and use -f NUT -> NVENC (Yup, a very inefficient 3 way pipe)

    Like I said, I gained nothing, as a matter of fact I feel sorry for myself having invested so much time with no real positive outcome...

    I would have been better off working on my task of learning C#.

    Andrew
    Quote Quote  
  13. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Here is my system spec: No slouch of a machine, but not SpaceX ready either..



    Number of cores 4 (max 4)
    Number of threads 8 (max 8)
    Manufacturer AuthenticAMD
    Name AMD Ryzen 5 2400G
    Specification AMD Ryzen 5 2400G with Radeon Vega Graphics
    Package Socket AM4





    Memory Type DDR4
    Memory Size 32 GBytes
    Memory Frequency 1064.5 MHz
    Memory type DDR4
    Module format UDIMM
    Module Manufacturer(ID) Corsair
    SDRAM Manufacturer (ID) SK Hynix
    Size 8192 MBytes
    Max bandwidth DDR4-2132 (1066 MHz)
    Part number CMK16GX4M2B3000C15





    Mainboard Model PRIME B450M-A
    DMI Baseboard
    vendor ASUSTeK COMPUTER INC.
    model PRIME B450M-A
    revision Rev X.0x




    Drive 0
    Name WDC WDS500G2B0A
    Revision X61190WD
    Capacity 465.8 GB
    Type Fixed, SSD
    Bus Type SATA (11)





    Display adapter 0
    Name NVIDIA GeForce GTX 1050 Ti
    Board Manufacturer ASUSTeK Computer Inc.
    Memory type GDDR5 (Samsung)
    Memory size 4 GB





    Software
    Windows Version Microsoft Windows 10 (10.0) Home 64-bit (Build 19042)
    DirectX Version 12.0
    Quote Quote  
  14. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Here is 400+ fps encode with Nvidia GPU (GTX 1050ti) and NVENC Vs. 70 fps with CPU and NVENC

    Image
    [Attachment 62116 - Click to enlarge]
    Quote Quote  
  15. when you used VLC by itself to encode (yes limited options), was it in sync ?

    when yo used handbrake by itself, was it in sync ?

    what kind of sync issues with ffmpeg ? Constant offset or progressively worsening ? How much out of sync ?
    Quote Quote  
  16. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Originally Posted by poisondeathray View Post
    when you used VLC by itself to encode (yes limited options), was it in sync ?

    when yo used handbrake by itself, was it in sync ?

    what kind of sync issues with ffmpeg ? Constant offset or progressively worsening ? How much out of sync ?
    I cannot remember the term for the error I was getting, I would have to reconstruct it and follow up later...

    I do know that HB typically will "read anything" and figure it out and encode a good file; however
    HB does not have several of the features that FFMEPG has, such as pipe input and output. Also there is
    a lack of video and audio filters.

    FFMPEG will choke with a bad VOB file, but has all the features you want.. but to do a simple thing like limit
    bitrate while encoding NVENC simply doesnt work... and access to VPP filters is difficult to figure out and implement.

    NVENC pretty much is my go-to for encoding 264 or 265 via NVENC, it also supports all FFMPEG audio filters, and
    VPP video filters very easy; but it does not like a VOB that has bad or missing PTS. To fix that, I just remux it
    with FFMPEG and tell it to generate new PTS, and NVENC will read the VOB no problem.
    ffmpeg_x64 -fflags +genpts -i "video.mpg" -c:a copy -c:v copy -y "%%~na.mpg"


    Then there is VLC, it seams not matter how wonky the VOB is, it plays it just fine on the screen.. so I figured,
    Ill just use VLC to read the file and pipe it to NVENC, right? Problem with that is, the module that does piping
    is the module that does transcode/encode, and is not the same module that reads and displays the video.
    (Think: ffmpeg & ffplay in a GUI). When I finally got it all working, I was better off just sticking with my original
    work flow.

    Typically I "fix" a vob with a VBS that calls VideoRedo to process the VOB, if anything is wonky it 99% of the time resolves it.
    (Takes about 2 minutes)

    Then I go ahead and remux it with ffmpeg and makre sure PTS are built so NVENC can read it.
    (takes about 20 seconds)

    After that, I use NVENC to encode.


    My success rate is 99% where as without some back end prep work, I might be 85%.

    Now, not all vobs *need* the prep work, but you do not know until you try to encode one directly,
    so as an automated / unattended process (batch file) I just let it process every vob and assure
    higher hitrate.

    I may have actually answered your question If not, let me know and Ill try to expand.

    Cheers,
    Andrew
    Last edited by RogerTango; 2nd Dec 2021 at 15:21.
    Quote Quote  
  17. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    BTW, here is my NVENC string for progessive source:

    Code:
    nvencc64 --avhw -i "%%~na.mpg" --avsync forcecfr --fps 23.976 --profile main --level 4 --dar 16:9 --multipass 2pass-full --cbr 4000K --codec h264 --lookahead 10 --audio-codec aac --audio-stream :stereo --audio-filter "compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2,volume=3" --audio-bitrate 128 --vpp-resize lanczos4 --output-res 1280:720 -o "%%~na (720).mp4"
    Image
    [Attachment 62120 - Click to enlarge]
    Last edited by RogerTango; 2nd Dec 2021 at 15:23.
    Quote Quote  
  18. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Here is my NVENC string for interlaced source, you need to know if it is TFF or BFF and apply switches as needed

    Code:
    nvencc64 --avhw -i "%%~na.mpg" --avsync forcecfr --fps 29.976 --profile main --level 4 --dar 16:9 --cbr 4000k --codec h264 --lookahead 10 --audio-codec aac --audio-stream :stereo --audio-filter "compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2,volume=3" --audio-bitrate 128 --interlace bff --vpp-yadif mode=auto --vpp-resize lanczos4 --output-res 1280:720 -o "%%~na (720).mp4"
    Quote Quote  
  19. What is your problem with ffplay? Provide command - there should be no issue with ffplay and ffmpeg pipe - usually i pipe to ffplay from ffmpeg (to adjust ffmpeg processing options and ffplay works as preview) but there should be no issue in reverse direction.
    Quote Quote  
  20. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Originally Posted by pandy View Post
    What is your problem with ffplay? Provide command - there should be no issue with ffplay and ffmpeg pipe - usually i pipe to ffplay from ffmpeg (to adjust ffmpeg processing options and ffplay works as preview) but there should be no issue in reverse direction.
    I have no need to pipe from FFMPEG *to* FFPLAY, I would however like to pipe from FFPLAY *to* FFMPEG but there is no way that I can find do perform that task.
    Quote Quote  
  21. Originally Posted by RogerTango View Post
    I have no need to pipe from FFMPEG *to* FFPLAY, I would however like to pipe from FFPLAY *to* FFMPEG but there is no way that I can find do perform that task.
    Is there any possibility for you to use ffmpeg instead ffplay and pipe from ffmpeg to ffmpeg? (or is there any particular reason for using of ffplay instead ffmpeg?)
    Quote Quote  
  22. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Originally Posted by pandy View Post
    Originally Posted by RogerTango View Post
    I have no need to pipe from FFMPEG *to* FFPLAY, I would however like to pipe from FFPLAY *to* FFMPEG but there is no way that I can find do perform that task.
    Is there any possibility for you to use ffmpeg instead ffplay and pipe from ffmpeg to ffmpeg? (or is there any particular reason for using of ffplay instead ffmpeg?)
    The SWDEC of FFMPEG would be the same, I would just be wasting memory resources in the pipe, it would be like pouring water from one glass to another.

    Now, I *have* piped FFMPEG -> NVENCc with great success, where as NVENCc had a problem reading some VOBs I had but FFMPEG read them fine (tip: gotta use NUT format in order to pipe audio & video, if anyone needs that tidbit)

    Andrew
    Quote Quote  
  23. To made it simple:
    Remux only vob to mpg, with clever Ffmpeg-GUI.
    Quote Quote  
  24. Originally Posted by RogerTango View Post
    The SWDEC of FFMPEG would be the same, I would just be wasting memory resources in the pipe, it would be like pouring water from one glass to another.
    once again, last time i will ask - why you insist to use ffplay? why you can't use ffmpeg... this is not clear from beginning (if this make you happy you can copy ffmpeg and change his name to ffplay)

    hope you aware that ffmpeg/ffplay may use different decoders and you can explicitly call desired decoder, also some HW encoders/decoders need to be properly initialized to be usable in ffmpeg/ffplay

    hope you are aware that to support HW encoders/decoders you need proper ffmpeg/ffplay build

    highly recommends:
    https://docs.nvidia.com/video-technologies/video-codec-sdk/pdf/Using_FFmpeg_with_NVIDI...celeration.pdf
    https://docs.nvidia.com/video-technologies/video-codec-sdk/ffmpeg-with-nvidia-gpu/
    https://developer.nvidia.com/blog/nvidia-ffmpeg-transcoding-guide/
    https://trac.ffmpeg.org/wiki/HWAccelIntro


    Originally Posted by RogerTango View Post
    Now, I *have* piped FFMPEG -> NVENCc with great success, where as NVENCc had a problem reading some VOBs I had but FFMPEG read them fine (tip: gotta use NUT format in order to pipe audio & video, if anyone needs that tidbit)
    you can use different formats for pipe, NUT is one of them (native for ffmpeg)
    if you going for maximum speed then perhaps you can avoid decode in ffmpeg and try to stream elementary streams from VOB


    tip:
    there is no such thing as "--fps 29.976" but instead there is something like --fps <int>/<int> or <float> i.e. "--fps 30000/1001" (approx float "--fps 29.97002997002997002997002997003")


    Originally Posted by ProWo View Post
    To made it simple:
    Remux only vob to mpg, with clever Ffmpeg-GUI.

    ffmpeg can remux mpeg ES from vob to mpeg Program Stream (i.e. mpg) too...
    Quote Quote