Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
play a .sdp file describing a UDP/RTP H264 stream iOS 8+
26 avril 2017, par AlexI´m looking into how to implement a simple app that can play a .sdp file (like VLC can do) in order to open a RTP stream made by GStreamer:
gst-launch-1.0 rpicamsrc bitrate=10000000 ! video/x-h264,width=1280,height=720,framerate=30/1 ! h264parse config-interval=1 ! rtph264pay ! udpsink host=192.168.100.123 port=1234
What would be the easiest way to do this in Swift/Objecvtive-C? Are there any built in functions or libraries I should know of?
-
ffmpeg send udp stream
26 avril 2017, par LuzwitzI stream my screen and i want send stream on a server with udp.
So, I have this command :
ffmpeg -ss 00:00:00 -s 1920x1080 -f x11grab -i :0.0+0,0 -copyts -vf "scale=-1:min(ih*1920/iw\,1080),pad=1920:1080:(1920-iw)/2:(1080-ih)/2:black" -c:v libvpx -b:v 4M -crf 16 -quality realtime -cpu-used 8 -c:a libvorbis -f webm udp://127.0.0.1:8080
And server in C :
int sock, clientlen, n, port = 8080; char buf[1024], *host; FILE *file; struct sockaddr_in serveraddr; struct sockaddr_in clientaddr; struct hostent *hostp; sock = socket(AF_INET, SOCK_DGRAM, 0); bzero((char *) &serveraddr, sizeof(serveraddr)); serveraddr.sin_family = AF_INET; serveraddr.sin_addr.s_addr = htonl(INADDR_ANY); serveraddr.sin_port = htons((unsigned short)port); if(bind(sock, (struct sockaddr *) &serveraddr, sizeof(serveraddr)) < 0) clientlen = sizeof(clientaddr); file = fopen("out.webm", "wb")); printf("En attente de données...\n"); while(1) { bzero(buf, 1024); n = recvfrom(sock, buf, 1024, 0, (struct sockaddr *) &clientaddr, &clientlen); hostp = gethostbyaddr((const char *)&clientaddr.sin_addr.s_addr, sizeof(clientaddr.sin_addr.s_addr), AF_INET); host = inet_ntoa(clientaddr.sin_addr); fwrite(buf, n, 1, file); }
And, when i play out.webm, i haven't video.
-
Probabilistic-Volumetric-3D-Reconstruction ubuntu ffmpeg [on hold]
26 avril 2017, par 董学强I download the code from enter link description here.Then I mkdir build .cd build. cmake .. ererything goes well. But when i make i meet with this error as following :
[ 34%] Built target vgui_test_drawpix_speed2 [ 34%] Built target vgui_test_template_include [ 35%] Built target vidl [ 35%] Built target vidl_gui [ 35%] Built target vidl_gui_test_include [ 35%] Built target vidl_test_template_include [ 35%] Built target vidl_test_include [ 35%] Built target vidl_test_all [ 35%] Linking CXX executable ../../../bin/vidl_transcode_video ../../../lib/libvidl.a(vidl_ffmpeg_istream.cxx.o): In function `vidl_ffmpeg_istream::open(std::string const&)': vidl_ffmpeg_istream.cxx:(.text+0x3d5): undefined reference to `av_frame_alloc' ../../../lib/libvidl.a(vidl_ffmpeg_ostream.cxx.o): In function `vidl_ffmpeg_ostream::close()': vidl_ffmpeg_ostream.cxx:(.text+0x124f): undefined reference to `av_packet_unref' ../../../lib/libvidl.a(vidl_ffmpeg_ostream.cxx.o): In function `vidl_ffmpeg_ostream::write_frame(vil_smart_ptr const&)': vidl_ffmpeg_ostream.cxx:(.text+0x16f5): undefined reference to `av_frame_alloc' vidl_ffmpeg_ostream.cxx:(.text+0x1b3b): undefined reference to `av_packet_unref' collect2: error: ld returned 1 exit status make[2]: *** [bin/vidl_transcode_video] Error 1 make[1]: *** [core/vidl/examples/CMakeFiles/vidl_transcode_video.dir/all] Error 2 make: *** [all] Error 2
Here are the code of vidl_ffmpeg_ostream.cxx and vidl_ffmpeg_istream.cxx:
// This is core/vidl/vidl_ffmpeg_ostream.cxx #include "vidl_ffmpeg_ostream.h" #include
vidl_config.h> #if VIDL_HAS_FFMPEG // The ffmpeg API keeps changing, so we use different implementations // depending on which version of ffmpeg we have. extern "C" { // some versions of FFMPEG require this definition before including // the headers for C++ compatibility #define __STDC_CONSTANT_MACROS #if FFMPEG_IN_SEVERAL_DIRECTORIES #include avcodec.h> #else #include avcodec.h> #endif } #include "vidl_ffmpeg_convert.h" #if LIBAVCODEC_BUILD < ((51<<16)+(49<<8)+0) // ver 51.49.0 # include "vidl_ffmpeg_ostream_v1.hxx" #elif LIBAVCODEC_BUILD < ((52<<16)+(10<<8)+0) // before ver 52.10.0 # include "vidl_ffmpeg_ostream_v2.hxx" #elif LIBAVCODEC_BUILD < ((53<<16)+(0<<8)+0) // before ver 53.0.0 # include "vidl_ffmpeg_ostream_v3.hxx" #elif LIBAVCODEC_BUILD < ((53<<16)+(24<<8)+0) // before ver 53.24.0 # include "vidl_ffmpeg_ostream_v4.hxx" #elif LIBAVCODEC_BUILD < ((54<<16)+(23<<8)+100) // before ver 54.23.100 # include "vidl_ffmpeg_ostream_v0.9.hxx" #elif LIBAVCODEC_BUILD < ((56<<16)+(0<<8)+100) // before ver 56.0.100 # include "vidl_ffmpeg_ostream_v0.11.hxx" #else # include "vidl_ffmpeg_ostream_v56.hxx" #endif #else // VIDL_HAS_FFMPEG # include "vidl_ffmpeg_ostream_stub.hxx" #endif // VIDL_HAS_FFMPEG emphasized text
// This is core/vidl/vidl_ffmpeg_istream.cxx #include "vidl_ffmpeg_istream.h" #include
vidl_config.h> #if VIDL_HAS_FFMPEG #include "vidl_ffmpeg_ostream.h" // The ffmpeg API keeps changing, so we use different implementations // depending on which version of ffmpeg we have. extern "C" { // some versions of FFMPEG require this definition before including // the headers for C++ compatibility #define __STDC_CONSTANT_MACROS #if FFMPEG_IN_SEVERAL_DIRECTORIES #include avformat.h> #else #include avformat.h> #endif } #if LIBAVFORMAT_BUILD < ((52<<16)+(2<<8)+0) // before ver 52.2.0 # include "vidl_ffmpeg_istream_v1.hxx" #elif LIBAVFORMAT_BUILD < ((53<<16)+(0<<8)+0) // before ver 53.0.0 # include "vidl_ffmpeg_istream_v2.hxx" #elif LIBAVFORMAT_BUILD < ((53<<16)+(24<<8)+0) // before ver 53.24.0 # include "vidl_ffmpeg_istream_v3.hxx" #elif LIBAVFORMAT_VERSION_MAJOR < 56 // before avformat ver 57.0 # include "vidl_ffmpeg_istream_v3.hxx" #else # include "vidl_ffmpeg_istream_v56.hxx" #endif #else // VIDL_HAS_FFMPEG # include "vidl_ffmpeg_istream_stub.hxx" #endif // VIDL_HAS_FFMPEG I don't know what's wrong I have got .What i need to do ?Anyone can help me ?
-
Can we limit max fps by using FFMPEG ?
26 avril 2017, par AlexandrI want to limit max fps when I process a video.
For example: set limit up to 30 frames per second.
If I process a video with 24 fps then I don't change fps but if I process the video with 60 fps then I change fps to 30.
Can it be done by using only FFmpeg (with filters or something else)?
I think that it can be done by using filter like this:-filter:v "fps=fps='min($CURRENT_FPS,30)'"
But I don't know is it possible to get current fps from an expression.
-
FFmpeg - Convert MP4 to Webm very slow
26 avril 2017, par LuzwitzI need convert MP4 to webm with ffmpeg. So, i use :
ffmpeg -i input.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis output.webm
But it's very long.
Is there faster ?