Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
How do I create RTMP stream from a picture ? [on hold]
6 février 2017, par Muhammad UmerNow first the goal:
I want to create a live video stream where people can vote and such, and it shows total votes in the live video.
However, I have zero experience with streaming.
After some thought My solution is this:
Create a picture every 5 seconds and replace the old picture, new picture contain total number of votes.
From old picture somehow create a continous live stream.
I think it could be very easy or very hard.
I am using nodejs, open to better performance oriented language suggestions.
-
Is there an elegant way to split a file by chapter using ffmpeg ?
6 février 2017, par KatternIn this page, Albert Armea share a code to split videos by chapter using
ffmpeg
. The code is straight forward, but not quite good-looking.ffmpeg -i "$SOURCE.$EXT" 2>&1 | grep Chapter | sed -E "s/ *Chapter #([0-9]+.[0-9]+): start ([0-9]+.[0-9]+), end ([0-9]+.[0-9]+)/-i \"$SOURCE.$EXT\" -vcodec copy -acodec copy -ss \2 -to \3 \"$SOURCE-\1.$EXT\"/" | xargs -n 11 ffmpeg
Is there an elegant way to do this job?
-
C++ FFMPEG not writing AVCC box information
5 février 2017, par awrI'm trying to encode raw H264 into an mp4 container using the FFMPEG API in C++. It all works fine, however the AVCC box is empty, and it returns the error: [iso file] Box "avcC" size 8 invalid
If I then use the command line tool on the output file: ffmpeg -i output.mp4 -vcodec copy fixed.mp4
The output file works and AVCC is populated with the required information. I'm at a loss as to why this command line argument works but I'm unable to produce the same result using the API.
What I do in the C++ code (also do things in between the function calls):
outputFormat_ = av_guess_format( "mp4", NULL, NULL ); //AV_CODEC_H264 formatContext_ = avformat_alloc_context(); formatContext_->oformat = outputFormat_; ... AVDictionary *opts = NULL; char tmpstr[50]; sprintf(tmpstr, "%i", muxRate * KILOBYTESTOBYTES); av_dict_set(&opts, "muxrate", tmpstr, 0); avformat_write_header( formatContext_, &opts); av_write_trailer(formatContext_);
The output of this is correct, except it's missing the AVCC information. Adding this is manually (and fixing the box lengths accordingly) lets me playback the video fine. Any idea why the API calls are not generating the AVCC info?
For reference, here's the chars from the mp4 before the fix: .avc1.........................€.8.H...H..........................................ÿÿ....avcC....stts
and after: avc1.........................€.8.H...H..........................................ÿÿ...!avcC.B€(ÿá..gB€(Ú.à.—•...hÎ<€....stts
-
ffmpeg override the same file for every second of the video [on hold]
5 février 2017, par Dorin PleavaI want to get one image for every 10 seconds from a livestream/video, but the image should have the same name, meaning I want to override it every cycle.
This is my command:
ffmpeg.exe -i http://iphone-streaming.ustream.tv/uhls/17074538/streams/live/iphone/playlist.m3u8 -bt 20M -s 480x300 -vf fps=1/10 -y photo.jpg
This code works for one image but for the next I get this
"Could not get frame filename number 2 from pattern 'photo.jpg' (either set updatefirst or use a pattern like %03d within the filename pattern) av_interleaved_write_frame(): Invalid argument"
If I replace photo.jpeg with photo%03d.jpg I get photo001.jpec, followed by photo002.jpeg, etc.
-
Reformat an output in Bash
5 février 2017, par KennethI'm using this ffmpeg argument to get the black frame in a file:
ffmpeg -i ${arrayDesFichiers[$i]} -vf "blackdetect=d=3:pix_th=0.00" -an -f null - 2>&1 | grep black_duration >> log.txt
Now I'm getting this in my log.txt:
[blackdetect @ 0x7fd9add06bc0] black_start:0 black_end:3.2 black_duration:3.2
And I would like to reformat it to something like this:
black duration : 3.2 seconds
I'm pretty sure it's possible in Bash but how ?