FFmpeg Stream Transcoding - ffmpeg

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.

Related

Ffmpeg -c copy not carrying over audio track from mkv to hls stream

I am using ffmpeg to create an hls stream. The source is an mkv with multiple audio tracks. I have tried using -map to specify the audio stream as well. I also found that when I point ffmpeg to any other audio stream in the file it works. It's just the first audio stream that does not. At one point I replaced -c copy with -acodec aac -ac 6 on the first stream and I got sound which is great but I am only looking to copy the stream and not re-encode it. The next thing I tried was using other mkv videos I have. All are reflecting the same issue. The mkv's by itself play both audio and video fine in VLC. When playing the output.m3u8 in VLC the option to choose different audio tracks is greyed out. Here is the command I'm using:
ffmpeg -i "./video.mkv" -ss 00:00:00 -t 00:00:30 -c copy -f hls "output.m3u8"
I want the audio of my hls stream to reflect that of the mkv source:
Although what I get returned from the command above gives me no sound and shows me this in mediaInfo:
I've aslo noticed that hls does not support pcm. Is it possible dash could work with this stream because it is pcm?
HLS segments can be either MPEG-TS or fragmented MP4. Neither officially support PCM audio, so you'll have to convert it.
DASH uses fragmented MP4 as segment format.

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).

Use ffmpeg to stream VP8 encoded video over RTP

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.

Streaming a stream from website to Twitch with FFMPEG

Is it possible to stream a website with a livestream (i.e. ip-camera) via FFMPEG to Twitch? If yes, does anybody know how to achieve this?
Yes. FFmpeg has a built-in RTMP client (which is the protocol you'll use to send your video data to Twitch), FLV (the wrapper for your audio and video data), H.264 (the video codec), and AAC (the audio codec).
First, find your RTMP ingest URL: https://stream.twitch.tv/ingests/
Now, just run FFmpeg as you normally would to ingest your input, but set some additional parameters for the output:
ffmpeg [your input parameters] -vcodec libx264 -b:v 5M -acodec aac -b:a 256k -f flv [your RTMP URL]

Stream H264 To Android Using FFMPEG

I'm trying to stream a .ts file containing H.264 and AAC as an RTP stream to an Android device.
I tried:
.\ffmpeg -fflags +genpts -re -i 1.ts -vcodec copy -an -f rtp rtp://127.0.0.1:10
000 -vn -acodec copy -f rtp rtp://127.0.0.1:20000 -newaudio
FFMPEG displays what should be in your SDP file and I copied this into an SDP file and tried playing from VLC and FFPLAY. VLC plays audio but just gives errors re: bad NAL unit types for video. FFPLAY doesn't play anything.
My best guess if that the FFMPEG H.264 RTP implementation is broken or at least it doesn't work in video passthru mode (i.e. using the -vcodec copy).
I need a fix for FFMPEG or an alternate simple open-source solution. I don't want to install FFMPEG in my Android client.
thanks.
Have you tried vlc?I once used vlc for streaming. You can have a look at here.

Resources