from unix ffmpeg bash pipe to windows ''universe" - windows

I am trying to "translate" some script from bash to windows powershell
I tried to pass the simplest
ffmpeg -i video.mp4 -vn -sn -map 0:a:0 -f flac - | ffmpeg -i - -c:a aac oiji.m4a
the result is a failure
using -f wav - another failure
there is a way to make it work?
thank you

Related

How to change the bit rate of audio while converting from midi file to mp3 using ffmpeg/fluidsynth

I am trying to convert midi file to mp3 using fluidsynth and ffmpeg on Windows 10 OS.
fluidsynth -a alsa -T raw -F - "FluidR3Mono_GM.sf3" simple.mid | ffmpeg -ab 192k -f s32le -i simple.mp3
The audio bit rate specification : -ab 192k or -b:a 192k are creating an error:
You are applying an input option to an output file or viceversa.
Is there an option to specify bit rate in the above command.
Taken from Convert midi to mp3
Option placement matters with ffmpeg. You're attempting to apply an output option to the input.
ffmpeg [input options] input [output options] output
Corrected command:
fluidsynth -T raw -F - sound_font_file.sf3 input.mid | ffmpeg -y -f s32le -i - -b:a 192k output.mp3
Fore more info about MP3 encoding with ffmpeg see FFmpeg Wiki: MP3.
Use timidity and ffmpeg
sudo apt-get install timidity
sudo apt-get install ffmpeg
If I have the file honorthyfather.mid you can choice
For midi to mp3
timidity honorthyfather.mid -Ow -o - | ffmpeg -i - -acodec libmp3lame -ab 320k honorthyfather.mp3
For more quality use WAV
timidity honorthyfather.mid -Ow -o - | ffmpeg -i - -acodec pcm_s16le honorthyfather.wav
For quality same WAV but low size use FLAC
timidity honorthyfather.mid -Ow -o - | ffmpeg -i - -acodec flac honorthyfather.flac

Ffmpeg change audio file bitrate and pass the output to pipe

I used to change the bitrate of audio files by using
ffmpeg -i input.mp3 -ab 96k output.mp3
and it works perfectly. Now I want to pass the output as pipe in Ffmpeg and perform some other task. I have took the reference of this documentation and modified the above ffmpeg command into
ffmpeg -i input.mp3 -ab 96k pipe:1 | aws s3 cp - s3://mybucket/output.mp3
But this doesn't work.
Only if i use pipe as below then it works.
ffmpeg -i input.mp3 -f mp3 pipe:1 | aws s3 cp - s3://mybucket/output.mp3
But this doesn't change the bitrate of the audio. Can anyone please help me how can I achieve my target of changing the bitrate and passing the output as Pipe
You have to specify the output format manually. When outputting to file, ffmpeg guesses format based on extension, which can't be done when piping.
Use
ffmpeg -i input.mp3 -ab 96k -f mp3 pipe:1 | aws s3 cp - s3://mybucket/output.mp3

ffmpeg play RTSP stream while recording

I successfully record to a file a RTSP stream using ffmpeg with the following command:
ffmpeg -i "rtsp://1.1.1.1:554/user=admin&password=admin&channel=1&stream=1" -acodec copy -vcodec copy -movflags frag_keyframe+empty_moov -y http://www.example.com/rec/1.mp4
now I need to play video while ffmpeg is still writing to file. Even changing file format, is it possible?
Pipe a 2nd output to ffplay
ffmpeg -i "rtsp://1.1.1.1:554/user=admin&password=admin&channel=1&stream=1" -acodec copy -vcodec copy -movflags frag_keyframe+empty_moov -y http://www.example.com/rec/1.mp4 -c copy -f nut - | ffplay

ffmpeg how to record and preview at the same time

I want to capture video+audio from directshow device like webcam and stream it to RTMP server. This part no problem. But the problem is that I want to be able to see the preview of it. After a lot of search someone said pipe the input using tee muxer to ffplay. but I couldn't make it work. Here is my code for streaming to rtmp server. how should I change it?
ffmpeg -rtbufsize 8196k -framerate 25 -f dshow -i video="Microsoft® LifeCam Studio(TM)":audio="Desktop Microphone (Microsoft® LifeCam Studio(TM))" -vcodec libx264 -acodec aac -strict -2 -b:v 1024k -b:a 128k -ar 48000 -s 720x576 -f flv "rtmp://ip-address-of-my-server/live/out"
Here is the final code I used and it works.
ffmpeg -rtbufsize 8196k -framerate 25 -f dshow -i video="Microsoft® LifeCam Studio(TM)":audio="Desktop Microphone (Microsoft® LifeCam Studio(TM))" -vcodec libx264 -acodec aac -strict -2 -f tee -map 0:v -map 0:a "[f=flv]rtmp://ip-address-and-path|[f=nut]pipe:" | ffplay pipe:
The core command for those running ffmpeg on a Unix-compatible system (e.g. MacOS, BSD and GNU-Linux) is really quite simple. It's to redirect or to "pipe" one of the outputs of ffmpeg to ffplay. The main problem here is that ffmpeg cannot autodetect the media format (or container) if the output doesn't have a recognizable file extension such as .avi or .mkv.
Therefore you should specify the format with the option -f. You can list the available choices for option -f with the ffmpeg -formats command.
In the following GNU/Linux command example, we record from an input source named /dev/video0 (possibly a webcam). The input source can also be a regular file.
ffmpeg -i /dev/video0 -f matroska - filename.mkv | ffplay -i -
A less ambiguous way of writing this for non-Unix users would be to use the special output specifier pipe.
ffmpeg -i /dev/video0 -f matroska pipe:1 filename.mkv | ffplay -i pipe:0
The above commands should be enough to produce a preview. But to make sure that you get the video and audio quality you want, you also need to specify, among other things, the audio and video codecs.
ffmpeg -i /dev/video -c:v copy -c:a copy -f matroska - filename.mkv | ffplay -i -
If you choose a slow codec like Google's AV1, you'd still get a preview, but one that stutters.

How to pipe the FFmpeg output to multiple ffplay?

I use the following command to pipe the FFmpeg output to 2 ffplay , but it doesn't work.
ffmpeg -ss 5 -t 10 -i input.avi -force_key_frames 00:00:00.000 -tune zerolatency -s 1920x1080 -r 25 -f mpegts output.ts -f avi -vcodec copy -an - | ffplay -i - -f mpeg2video - | ffplay -i -
How can I pipe the FFmpeg output to 2 (or more) ffplay?
I saw this page but it doesn't work for ffplay. (it is for Linux but my OS is windows)
Please help me
Thanks
There's some kind of Tee-Object (alias tee) in PowerShell but I'm not sure if it's similar to the one on Linux. You can try:
ffmpeg -re -i [...] -f mpegts - | tee >(ffplay -) | ffplay -
An alternative is to output to a multicast port on the local subnetwork:
ffmpeg -re -i [...] -f mpegts udp://224.0.0.1:10000
You can then connect as many clients as you require on the same address/port:
ffplay udp://224.0.0.1:10000

Resources