How to convert multicast to h265 - ffmpeg

I am trying to use latest ffmpeg.
ffmpeg -r 25 -i "udp://lo#238.108.108.11:1234? overrun_nonfatal=1&fifo_size=50000000" -c:v libx265 -preset ultrafast -x265-params crf=23 -strict experimental -f mpegts udp://lo#238.108.108.11:1234
and have error.
How to convert input mpeg-4 stream to h265?

you are download the stream from 238.108.108.11:1234 and trying to upload it to the same group. if ffmpeg will do it, then it should download all recent uploaded data and the again and again. try to upload encoded data to another group or another port if you would like the group is same.

Related

How to continue saving to an existing m3u8 playlist using ffmpeg

I'm using nginx rtmp module to run a live streaming server that encodes a rtmp stream to a hls playlist. Is there a way to continue with an existing m3u8 file instead of creating a new playlist when I start ffmpeg? Streams can be disconnected sometimes and I want to keep a single playlist when a user resumes streaming.
Here's ffmpeg command I'm running:
ffmpeg -i rtmp://localhost/live/$name -c:v libx264 -x264opts keyint=60:no-scenecut -s 720x1280 -r 30 -b:v 2000k -profile:v high -preset veryfast -c:a libfdk_aac -sws_flags bilinear -hls_list_size 0 /tmp/hls/$name_720p_.m3u8
You have to add the flag "append_list" to the directive hls_flags:
ffmpeg -i in.nut -hls_flags append_list out.m3u8
for more information:
https://ffmpeg.org/ffmpeg-formats.html
Use hls_cleanup off directive which in this case it won't remove old hls fragments and files, but you must use nginx rtmp hls instead of creating it with ffmpeg.
There is an option append_list, whose explanation reads: "append the new segments into old hls segment list". It might work for you.

ffmpeg Will stream be copied if same codec is requested?

I loop over some files and convert them with ffmpeg. I provide -vcodec h264. When the input video already is encoded with that codec: will the video stream be copied? How to make sure it's not reencoded in that case? Is it what -sameq was used previously?
You need to use -c:v copy if you want the raw H.264 stream to be passed on without re-encoding:
ffmpeg -i myh264file.mp4 -c:v copy -c:a copy myh264output.mp4
-c:a copy will also copy the audio
-c copy will copy both audio and video as in:
ffmpeg -i myh264file.mp4 -c copy myh264output.mp4
Detecting H.264 streams is not straight forward. You will need to code this.
For the -sameq settings please refer to this statement.
I would recommend upgrading to a recent version of ffmpeg if it is not already done as -vcodec is not used anymore, now it is -c:v.
The documentation on ffmpeg could help you.

How to wrap H264 into a mp4 container?

I have a program generating a bunch of raw H264 frames and would like to place that into a mp4 container for streaming.
Anyone know how to do that?
I was thinking I'd use ffmpeg however, this needs to be used commercially and it seems like ffmpeg can only do this through it's x264 library... which uses a GPL license.
Thank you!
If you're looking for the FFMPEG command line to do that, then try the following:
ffmpeg -i "source.h264" -c:v copy -f mp4 "myOutputFile.mp4"
If you have a separate audio file you can add it too:
ffmpeg -i "source.h264" -i "myAudio" -c:v copy -c:a copy -f mp4 "myOutputFile.mp4"
If your audio needs to be encoded as well (for instance codec AAC-LC, bitrate 256kbps):
ffmpeg -i "source.h264" -i "myAudio" -c:v copy -c:a aac -b:a 256k -strict -2 -f mp4 "myOutputFile.mp4"
libmp4v2 is under the MPL and can be used as part of a larger work commercially. It is much lighter than libavformat also.

Converted mp4 h264 baseline format loads long time

I have converted my video to mp4 x264 baseline format and it works fine with all pc/mobile phones , the problem is it takes long time to load the video while googling came to know that ffmpeg converts and sets the index file at the eof the video so it loads to the end to read and then plays the video, So any advices would be appreciatable to cut short the loading time.
Note:tryied out QT index swapper2 but dint give much difference , please advice .
this is the cmd i used to convert -
ffmpeg -i … -c:v libx264 -profile:v baseline -level 1 …
Thanks for your time .
You have several options to relocate the moov atom so the video can begin playback before it is completely downloaded by the client.
-movflags faststart
The easiest is the option -movflags faststart when re-encoding:
ffmpeg -i input -c:v libx264 -profile:v baseline -movflags faststart output.mp4
If you already encoded your .mp4 file, but simply want to move the atom:
ffmpeg -i input.mp4 -codec copy -movflags faststart output.mp4
You may need to get a more recent ffmpeg version to use this option. See the FFmpeg download page for links to ffmpeg builds for Linux, OS X, and Windows, or you can follow a step-by-step guide to compile ffmpeg.
qt-faststart
Alternatively you can use the qt-faststart tool that comes with the ffmpeg source:
cd ~/ffmpeg/tools
make qt-faststart
./qt-faststart input.mp4 output.mp4
MP4Box
Or you could use MP4Box (usually provided by the gpac package depending on your distro):
MP4Box -add input.mp4 output.mp4
Also See
FFmpeg and x264 Encoding Guide
FFmpeg and AAC Audio Encoding Guide

FMS FLV to mp3/aac/wav

How can I decode a FLV's audio if it's recorded from a live stream using Flash Media Server and uses NellyMoser codec?
I'm writing a script that process several FLVs, using FFmpeg, so I need a command line solution.
Any ideas?
This should work for you, since NellyMoser is supported by FFmpeg.
1. Using mp3
ffmpeg -i yourinput.flv -vn -acodec libmp3lame output.flv
2. Using AAC (switch aac with libfaac depending on which you have loaded)
ffmpeg -i yourinput.flv -vn -acodec libfaac output.mp4
I'm assuming of course you dont care about video.

Resources