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
+ Reply to Thread
Results 1 to 24 of 24
-
Last edited by RogerTango; 1st Dec 2021 at 15:46.
-
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"
-
-
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 -
-
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. -
-
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"
-
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 -
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 -
Here is 400+ fps encode with Nvidia GPU (GTX 1050ti) and NVENC Vs. 70 fps with CPU and NVENC
[Attachment 62116 - Click to enlarge] -
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 questionIf not, let me know and Ill try to expand.
Cheers,
AndrewLast edited by RogerTango; 2nd Dec 2021 at 14:21.
-
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"
[Attachment 62120 - Click to enlarge]Last edited by RogerTango; 2nd Dec 2021 at 14:23.
-
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"
-
-
-
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 -
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
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")
ffmpeg can remux mpeg ES from vob to mpeg Program Stream (i.e. mpg) too...
Similar Threads
-
ffmpeg and ffplay show different max audio volumedetect recommendations
By tas3086 in forum AudioReplies: 3Last Post: 27th Jun 2021, 15:50 -
How to pipe interlaced content from mencoder to ffmpeg?
By Selur in forum Newbie / General discussionsReplies: 1Last Post: 2nd Dec 2020, 02:15 -
Cannot pipe ffmpeg to nero
By ZetaStax in forum AudioReplies: 3Last Post: 13th Sep 2019, 06:58 -
is it possible to send ffmpeg images by using pipe?
By yanshof in forum ProgrammingReplies: 1Last Post: 18th Aug 2018, 07:18 -
how to pipe from ffmpeg to mencoder?
By marcorocchini in forum Newbie / General discussionsReplies: 3Last Post: 11th Jan 2017, 07:28