Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Sending multiple inputs over stdin to FFMPEG with Python
23 novembre 2016, par PeterI have the following command that I can run from the terminal that will overlay an image and apply a zoom pan filter.
ffmpeg -y -i image.jpeg -i overlay.png -pix_fmt yuv420p -filter_complex "[0:v]crop=out_w=in_w:out_h=in_w*0.562,scale=-2:3*ih,zoompan=z='min(zoom+0.0005,1.25)':d=75:x='iw/2-(iw/zoom/2)':y='ih/4-(ih/zoom/2)',overlay=0:0:enable='between(t,0,1)'[v]" -map "[v]" out.mp4
I'm now attempting to run this command from Python 2.7 using the subprocess module. I've had success in the past using this method when ffmpeg expects 1 input, but now that it expects 2 inputs I'm a little stuck.
from subprocess import Popen, PIPE filter = "[0:v]crop=out_w=in_w:out_h=in_w*0.562,scale=-2:3*ih,zoompan=z='min(zoom+0.0005,1.25)':d=75:x='iw/2-(iw/zoom/2)':y='ih/4-(ih/zoom/2)',overlay=0:0:enable='between(t,0,1)'[v]" img = open('image.jpeg') overlay = open('overlay'.png) video = Popen(['ffmpeg', '-f', 'image2pipe', '-y', '-i', '-', '-i', '-', '-pix_fmt', 'yuv420p', '-filter_complex', filter, '-map', "[v]" ,'out.mp4'], stdin=PIPE, stderr=PIPE) video.stdin.write(img.read()) video.stdin.write(overlay.read()) output, log = video.communicate()
and the output I am getting :
Input #0, image2pipe, from 'pipe:': Duration: N/A, bitrate: N/A Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 3597x5396 [SAR 300:300 DAR 3597:5396], 25 tbr, 25 tbn, 25 tbc pipe:: Invalid data found when processing input
-
FFmpeg check downloaded stream
23 novembre 2016, par Alexey BerezuevI'm downloading a m3u8 stream like this:
#EXTM3U #EXT-X-TARGETDURATION:5 #EXT-X-ALLOW-CACHE:YES #EXT-X-PLAYLIST-TYPE:VOD #EXT-X-VERSION:3 #EXT-X-MEDIA-SEQUENCE:1 #EXTINF:1.000, seg-1.ts #EXTINF:2.000, seg-2.ts #EXTINF:3.000, seg-3.ts #EXTINF:5.000, seg-4.ts
ffmpeg -i "https://example.com/mystream.m3u8" -c copy "videoname.mp4"
But, sometimes some of segments losses (http request may return an error). Is there any options to retry connection if it failed?
-
Re-encoding vlc-created mpeg2 .ts file results in 20 second file ; AKA : multi-stream file with hidden streams
23 novembre 2016, par insanerI was recording something with
vlc
off v4l2 (in case that makes a difference), and I just selected the first format that worked, being mpeg2 using TS container. File resulted in .ts extension, as automatically selected by vlc. When I then tried to put the video file in my video editor, it said the video was 19,884 hours long, when it should be about 6 minutes (it is ~80mb in size). When I try to play it in xine, it correctly shows the duration (vlc doesn't), and when I useffprobe
:[mpegts @ 0x9b2c0a0] max_analyze_duration 5000000 reached at 5000000 Input #0, mpegts, from 'loopbacktestcap.ts': Duration: N/A, start: 17978.139456, bitrate: N/A Program 1 Stream #0:0[0x44](): Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 104857 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc Stream #0:1[0x46](): Video: mpeg2video ([2][0][0][0] / 0x0002), 90k tbn
Notice especially this line:
Duration: N/A, start: 17978.139456, bitrate: N/A Program 1
I looked it up and it seems the lack of duration has to do with the container. But I have tried a few things to reencode (I tried -vcodec copy, mpeg2, libx264...) and all I can get is 20 second files of 1.1mb - 1.8mb.
So how can I reencode this file so the duration appears, and I get the full 6 minutes, instead of just the first 20 seconds?
-
Why ffmpeg convert only the first frame of my animated gif ? [duplicate]
23 novembre 2016, par CyriltraThis question already has an answer here:
My animated gif is around 37mo and last for around 10sec. I use the following command on debian to convert it to .mp4:
avconv -i test2_37m2.gif -pix_fmt yuv420p -vf \"scale=trunc(iw/2)*2:trunc(ih/2)*2\" test2_37m2_mp4.mp4 2>&1
The result is a 14kb .mp4 which is just a static frame (the first one) of the gif. Why ?
here is the output log of ffmpeg / avconv
avconv version 0.8.18-6:0.8.18-0+deb7u1, Copyright (c) 2000-2014 the Libav developers built on Oct 4 2016 17:59:06 with gcc 4.7.2 Input #0, image2, from '/var/www/clients/client1/web1/web/test/gif/test2_37m2.gif': Duration: 00:00:00.04, start: 0.000000, bitrate: N/A Stream #0.0: Video: gif, pal8, 640x360, 25 tbr, 25 tbn, 25 tbc Incompatible pixel format 'pal8' for codec 'libx264', auto-selecting format 'yuv420p' [buffer @ 0x1a4a820] w:640 h:360 pixfmt:pal8 [avsink @ 0x1a4aac0] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out' [scale @ 0x1a4ae20] w:640 h:360 fmt:pal8 -> w:640 h:360 fmt:yuv420p flags:0x4 [libx264 @ 0x1a4a060] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX [libx264 @ 0x1a4a060] profile Main, level 3.0 [libx264 @ 0x1a4a060] 264 - core 123 r2189 35cf912 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=0 b_adapt=1 b_bias=0 direct=1 weightb=0 open_gop=1 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.25 aq=1:1.00 Output #0, mp4, to '/var/www/clients/client1/web1/web/test/gif/test2_37m2_mp4.mp4': Metadata: encoder : Lavf53.21.1 Stream #0.0: Video: libx264, yuv420p, 640x360, q=-1--1, 25 tbn, 25 tbc Stream mapping: Stream #0:0 -> #0:0 (gif -> libx264) Press ctrl-c to stop encoding frame= 1 fps= 0 q=28.0 Lsize= 13kB time=10000000000.00 bitrate= 0.0kbits/s video:12kB audio:0kB global headers:0kB muxing overhead 6.292888% [libx264 @ 0x1a4a060] frame I:1 Avg QP:27.23 size: 12119 [libx264 @ 0x1a4a060] mb I I16..4: 49.2% 0.0% 50.8% [libx264 @ 0x1a4a060] coded y,uvDC,uvAC intra: 68.7% 45.8% 3.4% [libx264 @ 0x1a4a060] i16 v,h,dc,p: 22% 25% 22% 31% [libx264 @ 0x1a4a060] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 28% 21% 4% 5% 4% 9% 3% 7% [libx264 @ 0x1a4a060] i8c dc,h,v,p: 57% 29% 13% 1% [libx264 @ 0x1a4a060] kb/s:2423.80
Thank you
-
FFmpeg concat playlist to multiple bitrate rtmp stream
23 novembre 2016, par Kerr YangI have an Adobe Media Server on Windows Server 2008R2 to deliver live streaming online.
I use ffmpeg concat three playlist to three rtmp stream.But I found both three rtmp stream has same video bitrate.
Does there a ffmpeg command I can setting multiple bitrate to output rtmp stream?
Thanks you.
Command line
c:\FFmpeg\ffmpeg.exe -loglevel warning -xerror -re -f concat -safe 0 -i c:\ch3-plist-3.txt -c copy -f flv "rtmp://192.168.15.231:1935/live/live-ch3-3?adbe-live-event=liveevent&adbe-record-mode=record" -i c:\ch3-plist-2.txt -c copy -f flv "rtmp://192.168.15.231:1935/live/live-ch3-2?adbe-live-event=liveevent&adbe-record-mode=record" -i c:\ch3-plist-1.txt -c copy -f flv "rtmp://192.168.15.231:1935/live/live-ch3-1?adbe-live-event=liveevent&adbe-record-mode=record"
RTMP stream url
rtmp://192.168.15.231:1935/live/live-ch3-3
want to set video bitrate 2000k
rtmp://192.168.15.231:1935/live/live-ch3-2
want to set video bitrate 1200k
rtmp://192.168.15.231:1935/live/live-ch3-1
want to set video bitrate 500k
File list
( PS: each file has convert to 500k,1200k and 2000k H.264 mp4 )
ch3-plist-3.txt
file F:/video/G002001_0804_2000k.mp4 file F:/video/G002001_0893_2000k.mp4 file F:/video/G004002_0062_2000k.mp4
ch3-plist-2.txt
file F:/video/G002001_0804_1200k.mp4 file F:/video/G002001_0893_1200k.mp4 file F:/video/G004002_0062_1200k.mp4
ch3-plist-1.txt
file F:/video/G002001_0804_500k.mp4 file F:/video/G002001_0893_500k.mp4 file F:/video/G004002_0062_500k.mp4