Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
FFMpeg : setting letter spacing for drawtext
11 novembre 2013, par kkgzjjmjI'm using the following command for setting a waterark:
ffmpeg -i input.avi -vf "drawtext=fontfile='trebucbd.ttf':fontsize=30:fontcolor=white@0.4:x=w-text_w-12:y=12:text=my text" output.avi
How can I set
letter spacing
? -
How can I rename ts files in a m3u8 playlist
11 novembre 2013, par Okan GunerI have a ffmpeg command which converts rtmp stream to http live stream:
ffmpeg.exe -loglevel info -i %stream_input% -g 250 -r 15 -sc_threshold 0 -preset slow -keyint_min 15 -c:v libx264 -ar 44100 -b:v 200k -b:a 64k -profile:v baseline -level 3.0 -s 400x224 -aspect 16:9 -maxrate 200k -bufsize 1000k -map 0 -flags -global_header -f segment -segment_time 10 -segment_wrap 3 -segment_list_flags +live -segment_list_type m3u8 -segment_list playlist.m3u8 -segment_format mpegts segment%05d.ts 1>output.txt
This command creates ts files and m3u8 playlist. What I want to do is to keep ts file names same but rename them in the playlist. For example, Segment file: segment00000.ts, in playlist: Segment.aspx?ts=00000
#EXTM3U #EXT-X-VERSION:3 #EXT-X-MEDIA-SEQUENCE:0 #EXT-X-ALLOW-CACHE:YES #EXT-X-TARGETDURATION:17 #EXTINF:16.692244, segment00000.ts -> Rename it to Segment.aspx?ts=00000 #EXTINF:16.680789, segment00001.ts
Is it possible with ffmpeg?
-
Gstreamer basic tutorial gives blank screen
11 novembre 2013, par user763410I have the following gstreamer basic tutorial. When I compile and run the program, I am only getting a blank screen. The same happens when I use mplayer, but I supply -vo x11 option to it and it works well(for mplayer). So, I am guessing the issue gstreamer is also the same. So, my question is..."What should I do to tell the program that my output driver is x11?" How do I get rid of the blank screen?
Thanks
#include
gst.h> int main(int argc, char *argv[]) { GstElement *pipeline; GstBus *bus; GstMessage *msg; /* Initialize GStreamer */ gst_init (&argc, &argv); /* Build the pipeline */ /* pipeline = gst_parse_launch ("playbin2 uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm", NULL); */ pipeline = gst_parse_launch ("playbin2 uri=file:///home/mylogin/gstreamerstuff/sintel_trailer-480p.webm", NULL); /* Start playing */ gst_element_set_state (pipeline, GST_STATE_PLAYING); /* Wait until error or EOS */ bus = gst_element_get_bus (pipeline); msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, GST_MESSAGE_ERROR | GST_MESSAGE_EOS); /* Free resources */ if (msg != NULL) gst_message_unref (msg); gst_object_unref (bus); gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (pipeline); return 0; } -
FFmpeg muxing theora/vorbis unable to flush ?
11 novembre 2013, par user2979732I'm pretty new to ffmpeg and it's confusing. I'm working on a basic muxer and have been spending over a week on this - I don't normally post as I solve 98% of my issues with google, but unable to get this one so far.
The basis of my source is FFmpeg's own muxing.c example. When I try to force it using libvorbis for audio, and create "test.ogg" it demonstrates the same issues I'm having in my own derivation of muxing.c. The problem is with ogg/theora/vorbis. I'm forcing the use of audio codec like this:
audio_st = add_stream(oc, &audio_codec, avcodec_find_encoder_by_name("libvorbis")->id);
It seems the problem is in not setting audio pts in the muxing.c sample. There is a confusion in general about this, nobody apart from this guy didn't address what I am looking for http://webcache.googleusercontent.com/search?q=cache:6ml82RMN3YYJ:ffmpeg.org/pipermail/libav-user/2013-April/004304.html+&cd=4&hl=en&ct=clnk&gl=cz
I couldn't find any answers to that naturally - like why don't they set the audio pts? Laziness? Not needed? Do they believe all encoders will produce the pts for them(not true as seen below)?
Anyway, when you try muxing.c with mp4/libx264/forced libmp3lame all is fine, but the encoder says that "encoder did not produce valid pts, making some up.". However, it's silent with ogg/theora/vorbis, as if there were valid pts(?) but the result is no audio packets present in the stream(!), at least from what I saw using ffprobe. Which results in the video not being able to replay even, until you take out the empty audio stream. Then it plays the video, which shows that stream is fine.
Coming to my original issue. I tried setting the pts on the audio frame you're sending to the encoder to fix that problem(this already sucks). I was unable to find a definite answer how to properly set the pts - that's the other big issue as I'm trying stuff which I'm not sure works. Anyway, in the end when setting "some" pts, this results in ogg with sound.
if (frame->pts == AV_NOPTS_VALUE) frame->pts = audio_sync_opts; audio_sync_opts = frame->pts + frame->nb_samples;
I'm aware I should probably use rescaling to adjust for the container time bases etc..if this was present/explained in ffmpeg's own sample I wouldn't have to guess now (as I'm stil not 100% sure about time base relationship between container and codec, I think container time base takes somehow over the codec one).
My other problem is flushing - but that might have something to do with the screwed up pts. So I won't rather get into that in detail - the basic problem is, when I send finite number of audio frames, like 20, I get 2 packets only for example. From my understanding, I need to flush the rest of audio after all the encoding/muxing is done, which I managed to do with mp4/libx264/libmp3lame, but with ogg/theora/vorbis it doesn't flush. Why not, I have no idea.
If someone could rework muxing.c into sending it finite number of audio / video frames - ie . not until duration > X, but until it sent 20 video & 100 audio frames(just an example). So that number of frames I have is important, not the video time I end up with. Then encode / mux all the frames - with proper video/audio pts, working with theora/ogg and flushing if needed, that would probably solve all of my issues. I'm sure for an expert ffmpeg'er modifying muxing.c addressing all those things would be a pretty quick exercise and could help more than 1 confused person.
Thanks!
-
how to rapidly extract intraframe from a video (in c++ or python)
11 novembre 2013, par Thomas Andersoni want to capture some frame from a video so i used command like this:
ffmpeg -i MyVideo.mp4 -ss 1:20:12 -vframes 1 test-pic.jpg
but ffmpeg proccess frame from begin of video so this command is too slow. i research and i found some article about keyframe so i try to extract keyframe by a command like this
ffmpeg -vf select="eq(pict_type\,PICT_TYPE_I)" -i MyVideo.mp4 -vsync 2 -s 160x90 -f image2 thumbnails-%02d.jpeg
but this command also is to slow and capture too many frame. I need a linux command or c++ or python code to capture a frame that dont take long time