Use ffmpeg to stream VP8 encoded video over RTP - ffmpeg

I was able to create an mpeg encoded SRTP stream with ffmpeg, however I need to be able to stream VP8 encoded video.
This is the command I used to create an SRTP stream
ffmpeg -re -i BigBuckBunny.mp4 -f rtp_mpegts -acodec mp3 -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params <SOME_PRIVATE_KEY_HERE> srtp://127.0.0.1:20000
As I ultimately only need to stream video, and not audio, and the file is already a vp8 encoded webm, I assume the option I need to change is the -f rtp_mpegts but there doesn't seem to be an option for vp8
Is this possible with FFMEG?

mpegts is an video format for transmission, which is normally bundle with the MPEG-2 codec.
-f rtp_mpegts but there doesn't seem to be an option for vp8
libvpx is the ffmpeg encoder ( https://trac.ffmpeg.org/wiki/Encode/VP8 )
But if your video exist in VP8 codec, you don't need to recode this video again. You maybe need to rewrap this video into an transport format, which is optimal for your needs (https://en.wikipedia.org/wiki/Comparison_of_video_container_formats).
Maybe you should use webM as target container format.

Related

FFmpeg efficient capture from rtsp ipcamera

I need to capture an audio/video rtsp stream uncompressed in a file from ipcamera. Audio (pcm_alaw) and video (h264) must be synchronized. It is necessary that the file does not get corrupted if the camera loses the connection for a few moments (mp4).
At the moment I use the command below, but the ts codec does not support pcm_alaw and therefore the audio is not heard:
ffmpeg -stimeout 2000000 -rtsp_transport tcp -i rtsp://admin:1234#192.168.5.22/h264 -c:v copy -c:a copy -f mpegts -y main.ts
I use the mpegts codec because I need to check the duration of the capture in real time with the command:
ffprobe -i /home/pi/NAS/main.mov -show_entries format=duration -v quiet -of csv="p=0"
If i use mkv or avi its output would be:
N/A
The verification of the duration is important because I capture files of about 3 hours and at my choice I perform some data while the capture is in progress. I prefer not to compress the audio because I have often noticed some asynchrony with respect to the video when cutting.
Thank you.
Instead of -c:a copy you can use -c:a aac or -c:a mp3 to convert the audio stream before you save it.
MPEG-TS h264 is only compatible with mp3 or aac (source).

ffmpeg fails to Play Proxy Avid Interplay

My goal is transcode this file with ffmpeg.
https://drive.google.com/open?id=1ATuPtSbZeQLexB1HBP509hInDOTyfEV8
ffplay fails to analize or play this file and returns:
Invalid pixel format.
This is the simply command:
ffplay -i testproxy.mxf
ffprobe -i testproxy.mxf -show_stream
It has been encoded by avid Interplay whit this targhet quality:
H.264 800Kbps Proxy 1080i 25
Maybe it's a raw file? and need same specification ahead input file?
Any suggestion is appreciated
Either Interplay doesn't write* a standard MXF or there's a limitation in ffmpeg's mxf demuxer.
But you can play the file with
ffplay -vcodec h264 testproxy.mxf
and similarly, you can transcode using
ffmpeg -vcodec h264 -i testproxy.mxf ...
*more likely, as mediainfo also fails to detect the video codec.

ffmpeg conditional copy or encode audio stream

My objective is to DirectPlay all my content in Plex.
To do this, I have to conditionally re-encode some audio and video streams, to a format that can be played without the server having to transcode on the fly.
I am currently using HanbrakeCLI to encode video to x264 and audio to a compatible format.
I use the "--aencoder copy --audio-fallback ac3" options, to copy the audio stream as is if in a supported format, i.e. aac/ac3/eac3/truehd/dts/dtshd/mp3/flac, or to encode to ac3 if not a supported format.
I want to switch away from HandbrakeCLI because it does not support copying video streams, sometimes my media has a good video stream, but the audio needs to be encoded only, e.g. WMV with a VC1 video and WMAPro audio stream.
A commandline for HandbrakeCLI looks like:
// Create the HandbrakeCLI commandline and execute
// https://handbrake.fr/docs/en/latest/cli/cli-guide.html
string commandline = $"--input \"{inputname}\" --output \"{outputname}\" --format av_mkv --encoder x264 " +
$"--encoder-preset medium --quality {Settings.Default.VideoEncodeQuality} --subtitle 1,2,3,4 --audio 1,2,3,4 " +
$"--aencoder copy --audio-fallback ac3";
In ffmpeg I would use:
// Create the FFmpeg commandline and execute
// https://trac.ffmpeg.org/wiki/Encode/H.264
string commandline = $"-i \"{inputname}\" -c:v libx264 -crf {Settings.Default.VideoEncodeQuality} -preset medium -c:a copy -f matroska \"{outputname}\"";
Is there an equivalent to HandbrakeCLI's "--audio-fallback ac3" in ffmpeg?
I.e. I want the video to be encoded to x264, all audio tracks copied if the track is aac or ac3 or eac3 or truehd or dts or dtshd or mp3 or flac, and if not, encoded as ac3, while also copying all the subtitles and chapters as is.

FFmpeg : Check if the aac bitstream is malformed or not

I want to upload few sets of videos on my server and later play them in the HTML5 video tag. But some of them are not playing.
I checked the audio stream and video stream of the video, they have AAC and H264 codec respectively.So nothing seems wrong to me.
Then I tried re-encoding it, i got the following message:
malformated aac bitstream, use -absf aac_adtstoasc
av_interleaved_write_frame(): Operation not permitted
However I don't want to encode the videos before upload and just need to check if video has a malformed aac or h264 bitsream.
PS. Users are limited and will be provided with videos h264 and aac
encoded for the upload.
malformated aac bitstream, use -absf aac_adtstoasc doesn't mean the input stream is invalid. It's rather the re-encoding that's invalid. The idea is that you're using an MPEG-2 transport stream as input and the AAC stream in it uses the ADTS format.
If you want to re-encode the file and change the container to FLV or MP4 for example you MUST use the bitstream filter aac_adtstoasc to remove the ADTS header:
-bsf:a aac_adtstoasc
To view the input streams you can use ffprobe. Eg:
ffprobe -v quiet -print_format json -show_streams [input]
Verifying file integrity is another matter.
If the input is MPEG-TS it will not play in HTML5 natively. Check the uploaded format and re-encode to a HTML5 supported format.

FFmpeg Stream Transcoding

I have got a streaming application that displays the stream sent from a Flash Media Server.
I want to grab that stream and transcode it to a output stream with a different bitrate using ffmpeg.
Could such kind of thing be done using ffmpeg?
This will get input from a feed, and transcode it to an MKV file with default audio and video codecs, and 1024k bitrate for the video stream (audio bitrate is specified with '-ab'):
ffmpeg -i "http://my_server/video_feed" -b 1024k output.mkv
For a live feed try this (not sure if it'll work, I don't have ffmpeg to test it right now):
ffmpeg -i "http://my_server/input_video_feed" -b 1024 -f flv "http://my_server/output_video_feed"
This should create a FLV feed.

Resources