I'm wondering if it is possible to stream video while the video is being generated through conversion.
Any ideas?
Assuming that your copy of FFmpeg includes something like rtmp amongst the protocols listed with ffmpeg -protocols you should be able to do this using the split video filter. The whole command will look something like:
ffmpeg -i input.mp4 <video options> -filter split rtmp://server[:port][/app] out.mp4
well use the url you want to stream to (be it udp or rtmp) as output instead to output to a file.
To do both , you ll need to use pipe
Related
I'm using the Nodejs spawn() functionality to execute a shell command that goes like this:
ffmpeg -i https://someUrl.com/someVideo.mp4 -vf fps=30 frame-%d.bmp
Which works for me as to saving 30 frames per second into numbered files, but I'd like to save every frame into a local variable so I could parse it in whatever way I need to (specifically to a JSON).
What would be the best way to do so?
Thanks in advance.
I am currently working on a script to help me batch convert and
normalize audio files (wma to mp3)
In the search of useful tools I was lucky to stumble on FFMPEG-Normalize!
My script is running from Python and I am calling FFMPEG via subprocess.
I could not get the FFMPEG-Normalize to output Mp3 files - thus I am
doing another FFMPEG call to convert the resulted wav files.
Do you know how to make FFMPEG normalize also convert to mp3 ?
The second issue is that only part of the files in my folder are being
processed, I cant understand why. Out of 8 files I have in the path,
sometimes all of them are processed and sometimes only 3, or 5... very
weird!
Here is my code :
for file in sorted(os.listdir(pathdes)):
os.chdir(pathdes)
subprocess.call(['ffmpeg-normalize','-m','-l','-0.1',file])
file = 'normalized-' + file
file = file[:-3] + "wav"
file2 = file[:-3] + "mp3"
os.chdir(pathdes)
subprocess.call(['ffmpeg', '-i', file,'-b:a','320k', file2])
I understand FFMPEG normalize was written in Python, maybe there is
another way to call it other than subprocess ?
Am I missing something ? (i know i am !)
Thank you so much !
The ffmpeg-normalize tool allows you to set an audio encoder as well, using the -a, --acodec <acodec> option.
For example, to EBU R128-normalize a bunch of WAV files and encode them to MP3 with libmp3lame:
ffmpeg-normalize --ebu --acodec libmp3lame --extra-options "-b:a 192k" *.wav
Note that for MP3 specifically, you could use MP3Gain to change the volume without having to re-encode the files.
I'm trying to convert DVD iso files to mp4 using HandbrakeCLI. I use the following line in a batch file:
D:\HandBrakeCLI.exe -i "D:\input.iso" -o "D:\output.mp4" --no-markers --width "720" --height "480" --preset "HQ 480p30 Surround" --encoder "mpeg2" --audio-lang-list "eng"
When I do this, I must then extract the audio from the file, using the following line:
D:\eac3to\eac3to.exe "D:\output.mp4" "D:\output.wavs" -down16
However, when I attempt to extract the audio, I get the error message
The format of the source file could not be detected.
Is there anything wrong with my former line of code that's causing the mp4 to get screwed up?
Minor side question: I'm also trying to get handbrake to remove subtitles and also only keep English audio, do you know what code could be used for that? I started a bit there with the --audio-lang-list "eng" but I'm now sure what to do from there.
Thanks a lot in advance!
You need to use a valid audio format. .wavs is not valid. You have to use an available audio codec to output to the below for --aencoder. The default output audio for MP4 is .aac
av_aac
copy:aac
ac3
copy:ac3
eac3
copy:eac3
copy:truehd
copy:dts
copy:dtshd
mp3
copy:mp3
vorbis
flac16
flac24
copy:flac
opus
copy
Defaults for audio
av_mp4 = av_aac
av_mkv = mp3
You need to pass none for no subtitles
-s none
And define only eng track like you were doing
--audio-lang-list eng
Check out the Handbrake CLI Documentation for the command line code:
https://handbrake.fr/docs/en/latest/cli/cli-guide.html
You can also try using a different program once you extract the audio. A program like XMediaRecode. It can also remux audio and video and convert other audio formats to wav
https://www.videohelp.com/software/XMedia-Recode
Here is the input manifest:
$ curl 'https://example.net/ipadlive/index_new.m3u8?sessionid=81893121496608402793&ipaddress=x.x.x.x&callsign=YYYY&hubid=51&zipcode='
#EXTM3U
#EXT-X-VERSION:4
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group",NAME="eng",DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="en",URI="https://example.net/ipadlive/06_new.m3u8?cdnHost=da148.cdn.iptv.example.net&sessionid=81893121496608402793&ipaddress=x.x.x.x&callsign=CHAN&hubid=51&zipcode=&countycode=null&fta=null&optimumid=null&devicename=&devicetype=0&osver=&res=&fps="
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group",NAME="spa",DEFAULT=NO,AUTOSELECT=YES,LANGUAGE="en",URI="https://example.net/ipadlive/07_new.m3u8?cdnHost=da148.cdn.iptv.example.net&sessionid=81893121496608402793&ipaddress=x.x.x.x&callsign=CHAN&hubid=51&zipcode=&countycode=null&fta=null&optimumid=null&devicename=&devicetype=0&osver=&res=&fps="
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=479776,RESOLUTION=240x180,CODECS="avc1.42c00c,mp4a.40.2",AUDIO="group"
https://example.net/ipadlive/01_new.m3u8?cdnHost=da148.cdn.iptv.example.net&sessionid=81893121496608402793&ipaddress=x.x.x.x&callsign=CHAN&hubid=51&zipcode=&countycode=null&fta=null&optimumid=null&devicename=&devicetype=0&osver=&res=&fps=
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=780576,RESOLUTION=320x240,CODECS="avc1.42c00d,mp4a.40.2",AUDIO="group"
https://example.net/ipadlive/02_new.m3u8?cdnHost=da148.cdn.iptv.example.net&sessionid=81893121496608402793&ipaddress=x.x.x.x&callsign=CHAN&hubid=51&zipcode=&countycode=null&fta=null&optimumid=null&devicename=&devicetype=0&osver=&res=&fps=
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1079872,RESOLUTION=480x360,CODECS="avc1.42c01e,mp4a.40.2",AUDIO="group"
https://example.net/ipadlive/03_new.m3u8?cdnHost=da148.cdn.iptv.example.net&sessionid=81893121496608402793&ipaddress=x.x.x.x&callsign=CHAN&hubid=51&zipcode=&countycode=null&fta=null&optimumid=null&devicename=&devicetype=0&osver=&res=&fps=
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1682976,RESOLUTION=640x480,CODECS="avc1.42c01e,mp4a.40.2",AUDIO="group"
https://example.net/ipadlive/04_new.m3u8?cdnHost=da148.cdn.iptv.example.net&sessionid=81893121496608402793&ipaddress=x.x.x.x&callsign=CHAN&hubid=51&zipcode=&countycode=null&fta=null&optimumid=null&devicename=&devicetype=0&osver=&res=&fps=
I've never seen this before where the audio stream is a separate url than a video stream listed in the manifest.
Is there a way I can combine an audio stream and a specific video stream to produce a new stream that has both audio and video in it?
I was doing something like this:
ffmpeg -i <manifest> -c copy test.m3u8 and I don't get any audio.
I've tried changing <manifest> to an individual video stream, but then no audio. If I change it to an AUDIO stream I get no video.
I recently had the problem of combining an audio .ts file with its accompanying video .ts file. I was able to solve it using the following method for Windows users. [see - Video resource ]
1) You will need to download the ffmpeg library that will allow Windows to combine both files together. In my case I was running Windows 8 (32 bit OS) and chose a static build:
2) I then opened notepad and wrote the following code once ffmpeg was installed:
ffmpeg -i VIDEO.ts -i AUDIO.ts -c:v copy -c:a copy OUTPUT.mp4
I saved the notepad file as "joiner.bat"
NB: this bat file must present in the same folder as your separate audio and video ts files in order to combine them!!!
3) Once the bat file is in the same folder as your audio and video ts files you can double click on the joiner.bat file to combine the audio and video ts files into a single mp4 (OUTPUT.mp4) file.
I hope this helps the more novice types among us. Yes I'm still a n00b after many years - don't worry! ;)
i want to try to experiment on jwplayer with video files which have 2 or more audio tracks. Can anyone provide me with a sample video or point to resource to download it?
Thank you in advance!
You can use MP4Box to construct such file as follows:
MP4Box -add file1.mp3 -add file2.mp3 output.mp4
You can use any format that MP4Box supports MP3, AAC, MP4, AVI, ...
I've created a simple example for GPAC's test files, available here.