I use ffmpeg to record rtsp stream, it work good but the output file got some proble, when I use use K-Lite Codec Pack to open the output (avi) file the video cant be seek, forward, backward and dont display video time. It lock like i am viewing streaming.
here is the command i used
ffmpeg -i rtsp://27.74.xxx.xxx:55/ufirststream -acodec copy -vcodec copy abc.avi
video playing error with K-Lite Codec Park image
Looks like header file not been updated on output file. It's recommended to close output file by pressing "q" button while ffmpeg reads input stream to properly finalize output file.
Related
I am trying to feed a mp4 file from ffmpeg to rtsp stream using the command on centos 7:
from console 1: ffmpeg -i space.mp4 -vcodec libx264 -tune zerolatency -crf 18 http://localhost:8050/feed1.ffm
from console 2: I have started ffserver and it is started listening.
But when i open http://x.x.x.x:8050/feed1.ffm in browser it shows error:
File ??feed1.ffm? not found
My ffserver.conf file is attached
Browser can't play RTSP directly so you need it delivered in a HTML5 format (HLS) that can load inside a VIDEO tag.
You can directly embed the mp4 inside a VIDEO tag if you wish.
FFMPEG needs to publish the video/stream to a streaming server that supports RTSP or the format you decide to publish as.
You can schedule mp4 videos to play as a live stream with this tool https://broadcastlivevideo.com/schedule-video-playlist-as-live-streaming-channel/ , available as free open source WP plugin.
I am attempting to create a online radio application using FFMPEG - an audio only DASH stream.
I have a directory of mp3 clips (all of the same bitrate and sample size) which I am encoding to the AAC format and outputting to a mpd.
This is the current command I am working with to stream a single mp3 file:
ffmpeg -re -i <input>.mp3 -c:a aac -use_timeline 1 -use_template 1 -window_size 5 -f dash <out>.mpd
(Input and output paths have been substituted for < input >.mp3 and < output >.mpd in this snippet)
I am running a web server and have made the mpd accessible on it. I am testing the stream using VLC player at the moment.
The problem:
Well, the command works, but it will only work for one clip at a time. Once the next command is run immediately proceeding the completion of the first, VLC player will halt and I need to refresh the player to continue.
I'm aiming for an uninterrupted stream wherein the clips play in sequence.
I imagine the problem is that a new mpd is being created with no reference to the previous one, and what I ought to be doing is appending segments to the existing mpd - but I don't know how to do that using FFMPEG.
The question: Is there such a command to append segments to a previously existing mpd file in FFMPEG? or am I coming at this problem all wrong? Perhaps I should be using FFMPEG to format the clips into these segments, but then adjusting the mpd file manually.
Any help or suggestions would be very much appreciated!
My goal: Stream a live HLS video in browser.
I have in a folder m3u8 files with some .ts. I can play the m3u8 in browser. But this isn't a live stream.
So i try to find a server to stream a HLS in live.
I work on Linux Ubuntu 14.04.
For example:
input /home/master.m3u8 i would like output http://127.0.0.1/master.m3u8
A flash player in browser play http://127.0.0.1/master.m3u8
Thx
You can use any HTTP server such as Nginx, Apache and others to serve your HLS stream.
To create the actual stream you can use ffmpeg:
ffmpeg -re -i <input> /path/to/web/dir/playlist.m3u8
The -re tells it to read the input file at its native framerate. By default the playlist size is 5 but you can change it using hls_list_size.
For a complete list of parameters see: https://www.ffmpeg.org/ffmpeg-formats.html#hls-1
How to transfer metadata using FFMPEG or other tools with CMD ?
I'm trying to encode video/audio and since they already have metadata inside obviously i want to preserve them into my new file
btw since i'm using mediamonkey as main player, there's also some Custom metadata. this is the one who wont transfer
for Video output file using mp4/mkv (using x264)
for Audio output file using m4a (using neroAac)
Thank You!
ps. which container is best for neroAac and x264? since i can't seem to edit mkv metadata (when i remove from mediamonkey playlist, they're all gone), mp4 is fine though and i can't seem to play AAC, although it's fine when muxed into video
Copy all custom and global metadata tag information using the following command:
ffmpeg <inputfile> -movflags use_metadata_tags -c copy <outputfile>
Recently I had a task to use ffmpeg as a transcoding as well a streaming tool. The task was to convert the file from a given format to MP4 and immediately stream it, by capturing it from stdout. So far so good. The streaming works well with the native player of android tabs as well as the VLC player. The issue is with the flash player. It gives the following error:
NetStream.Play.FileStructureInvalid : Adobe Flash cannot import files that have invalid file structures.
ffmpeg flags used are
$ ffmpeg -loglevel quiet -i somefile.avi -vbsf h264_mp4toannexb -vcodec libx264 \
-acodec aac -f MP4 -movflags frag_keyframe+empty_moov -re - 2>&1
As noted in the docs for -movflags
The mov/mp4/ismv muxer supports fragmentation. Normally, a MOV/MP4 file has all the metadata about all packets stored in one location (written at the end of the file, it can be moved to the start for better playback using the qt-faststart tool). A fragmented file consists of a number of fragments, where packets and metadata about these packets are stored together. Writing a fragmented file has the advantage that the file is decodable even if the writing is interrupted (while a normal MOV/MP4 is undecodable if it is not properly finished), and it requires less memory when writing very long files (since writing normal MOV/MP4 files stores info about every single packet in memory until the file is closed). The downside is that it is less compatible with other applications.
Either switch to a flash player that can handle fragmented MP4 files, or use a different container format that supports streaming better.
Also, -re is an input-only option, so it would make more sense to specify it before the input, instead of before the output.