How can I save the RAW rtp output file by ffmpeg - stream

I have a problem that to save Output RTP as a file.
(Is that a possible? Am I Right?)
Trans-coding goal as below:
1. Save the RTP stream to file in local storage using FFMPEG.
2. Input is file.
3. Output is RTP stream file.
I`m using that.
./ffmpeg -re -i ../Video_Sample/03.Fashion_DivX720p_ASP_87s_1000k_720p.mp4 -c:v libx264 -b:v 1000k -preset superfast -an -f rtp -y test.rtp
But I got a message like that :
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
How can I fix it?

RTP is the Real-time Transport Protocol and not a file.
If you want to stream your mp4 file you could do it as followed:
ffmpeg -re -f mp4 -i ../Video_Sample/03.Fashion_DivX720p_ASP_87s_1000k_720p.mp4 -vcodec libx264 -b 1000k -preset superfast -an -f rtp rtp://hostadress:port
Did you mean rpt (Report File) file?

Related

Anybody know what this avconv line does?

avconv -y -i input.avi -b 915k -an -f mp4 -ar 44100 -f s16le -ac 2 -i /dev/zero -acodec libfaac -ab 128k -strict experimental -shortest -vcodec libx264 output.mp4 -loglevel fatal
First of all, this seems to be an old version of avconv, since the command line has changed since then (but not too much).
So, let's break it down:
-y
This answers 'yes' to questions like "do you want to overwrite the output file".
-i input.avi
This gives the program the file input.avi as an input
-b 915k
This asks to change the bitrate to 915 Kibibytes per second
-an
This removes all the audio from the output.
-f mp4
Sets up MP4 as the format of the output file
-ar 44100
This sets audio sampling rate of the following input file.
-f s16le
This sets the format of the audio of the following input file.
-ac 2
This sets number of channels of audio to two.
-i /dev/zero
This adds another input file that consists entirely of zero input
-acodec libfaac
This reencodes the audio (silence most likely) with libfaac
-ab 128k
Setting the audio bitrate to 128 Kbps
-strict experimental
Allows avconv to use nonstandard approaches while encoding.
-shortest
Ends encoding when the shortest of the inputs has ended. This is needed because /dev/zero will never end.
-vcodec libx264
This sets the library to do the video encoding. The codec will be (unfortunately) h264
output.mp4
This is the name of the output file
-loglevel fatal
Fatal messages will be written as the log, and that's it.
In the future you may find man avconv to be your friend.

ffmpeg stream file to crtmp - How to change the resolution?

I'm using ffmpeg - streaming local file to crtmpserver (or other server):
ffmpeg.exe -re -i file.avi -vcodec libx264 -preset veryfast -acodec aac -strict experimental -f flv rtmp://256.257.0.0:1935/flvplayback/live
How to change the resolution? File has a resolution 1920x1080, but I want to send only 640x360.
-s 640x360 does not work.
Use -vf scale=640:360.
ffmpeg.exe -re -i file.avi -vf scale=640:360 -vcodec libx264 -preset veryfast -acodec aac -strict experimental -f flv rtmp://256.257.0.0:1935/flvplayback/live

YUV Raw frames to video stream

Im trying to stream raw YUV frames in an array generated in a C++ program to video using FFPEG. Can anyone point me to the right direction?
To stream piped YUV420 planar frames to RTMP try e.g.
ffmpeg -f rawvideo -c:v rawvideo -s 1920x1080 -r 25 -pix_fmt yuv420p -i - -c:v libx264 -f flv rtmp:///live/myStream.sdp

av_interleaved_write_frame(): Connection reset by peer youtube.

i want to live stream to youtube with ffmpeg but i take error " av_interleaved_write_frame(): Connection reset by peer". i send stream with FMLE its works nice.
ffmpeg -re -i /mnt/windows/21.mpg -r 30 -s 854x480 -c:v libx264 -c:a libfdk_aac -f mpegts "rtmp://a.rtmp.youtube.com/live2/hasanbagcaci.3s3v-pkwx-g64b-5zgz" -force_key_frames "expr:gte(t,n_forced*1)"
thanks for helping
I found a way to send a livestream to YouTube:
ffmpeg -re -i /mnt/windows/21.mpg -r 30 -s 854x480 -c:v libx264 -c:a libfdk_aac -force_key_frames "expr:gte(t,n_forced*4)" -f flv "rtmp://a.rtmp.youtube.com/live2/hasanbagcaci.3s3v-pkwx-g64b-5zgz"

Adding 2 pictures to a video with avconv

Here is the command that I am using to add a logo to a stream
avconv -f alsa -i pulse -f x11grab -s hd720 -i :1.0+nomouse -vf "movie=logo.png [watermark]; [in][watermark] overlay=10:10 [out]" -acodec libvo_aacenc -vcodec libx264 -threads auto -f flv rtmp://server
How can I add a second picture to the stream? Is there a way to do this without using -filter_complex as it's not available?
Thank you.
Yes, just add another set of movie and overlay filters. Something like (split over multiple lines for clarity)
-vf "
movie=logo1.png [watermark1];
movie=logo2.png [watermark2];
[in][watermark1] overlay=x1:y1 [watermarked1];
[watermarked1][watermark2]overlay=x2:y2[out]
"

Resources