Newest 'libx264' Questions - Stack Overflow
Les articles publiés sur le site
-
ffmpeg Connection to tcp ://127.0.0.1:1935 refused on Windows 10
6 mars 2024, par Wissam EliasI am trying to re-stream an RTSP connection on the local network using this command:
ffmpeg -loglevel debug -rtsp_transport tcp -i rtsp://192.168.1.13:1935 -codec copy -f rtsp rtsp://172.0.0.1:1935/live/stream
but i am getting an error message:
[tcp @ 0000020c99c4c1c0] Connection to tcp://127.0.0.1:1935 failed: Connection refused rtsp://127.0.0.1:1935/live/stream: Connection refused
while the port is not used and I've tried to use 8554 also with the same result, and the firewall on my device is turned off.
-
Error Linking FFmpeg with libx264 : Undefined Reference to __imp_x264_encoder_open_163
23 février 2024, par zeyuI'm attempting to compile FFmpeg with libx264 support on Windows using MinGW-w64, but I'm encountering a linking error when building . The error points to an undefined reference to in . Here are the details of the error message:libavcodec/avcodec-57.dll__imp_x264_encoder_open_163libx264.o
In fact, I want to run the AccMPEG branch from https://github.com/Alex-q-z/myh264.git, and I am looking to obtain an executable (exe) to run on Windows.
LD libavcodec/avcodec-57.dll E:/MSY/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libavcodec/libx264.o: in function `X264_init': E:\MSY\home\myh264\ffmpeg-3.4.8/libavcodec/libx264.c:818: undefined reference to `__imp_x264_encoder_open_163' collect2.exe: error: ld returned 1 exit status make: *** [ffbuild/library.mak:103: libavcodec/avcodec-57.dll] Error 1
Here's what I've tried so far:
Ensuring libx264 is compiled with shared library support using .--enable-shared Verifying that the libx264 version is compatible with the version of FFmpeg I'm compiling. Adding the path to libx264 binaries to my PATH environment variable. Environment Details:
OS: Windows 11 MSYS2 MinGW-w64 version: 13.2.0 FFmpeg version: 3.4.8 libx264 version: unknown Questions:
What could be causing this undefined reference error? Is there a specific version of libx264 that's known to work with FFmpeg 3.4.8? Are there additional flags or configurations I should use when compiling libx264 or FFmpeg to avoid this issue? Any guidance or suggestions would be greatly appreciated. Thank you in advance!
In fact, I want to run the AccMPEG branch from https://github.com/Alex-q-z/myh264.git, and I am looking to obtain an executable (exe) to run on Windows.
-
how to use x264 dll in another project
7 février 2024, par Hadi RasekhI want to use x264 in my project. There is some line in the code said:
`/* Application developers planning to link against a shared library version of
- libx264 from a Microsoft Visual Studio or similar development environment
- will need to define X264_API_IMPORTS before including this header.
- This clause does not apply to MinGW, similar development environments, or non
- Windows platforms. */`
But I don't get this line: define X264_API_IMPORTS before including this header
We can create x264 dll by its configuration and make
./configure --enable-shared make
but I can not use the dll in my Qt Project.
I can make my own dll (in another code) and use it in the project. But when I start to use x264 dll in my project I get the following error:
C:\DataHiding\SourceCode2\GUI\DataHiding\mainwindow.cpp:10: error: 'pulldown_frame_duration' was not declared in this scope qDebug() << pulldown_frame_duration[1]; ^
-
GStreamer x264enc Buffered Frames are Sped-Up after EOS Event
31 janvier 2024, par user21956843After sending EOS, the encoder sends its buffered frames down the pipeline, but the playback of those last ~2s of footage is sped up.
Pipeline:
autovideosrc [avfvideosrc] ! clockoverlay ! videoconvert ! video/x-raw,format=I420 ! x264enc bframes=0 bitrate=512 ! video/x-264,stream-format=avc,alignment=au,framerate=20/1 ! kvssink
The application plays the pipeline for 10s, then sends an EOS event on the source element. The custom sink
kvssink
streams frames to cloud storage, the playback of this 10s of footage is fine except for the encoder's ~2s of buffered frames that were sent out after the EOS event being sped up. How can I correct this? -
How to write a video file using FFmpeg
15 janvier 2024, par SummitI am trying to write a video file using FFMPEG but i get the following errors
[libx264 @ 000002bdf90c3c00] broken ffmpeg default settings detected [libx264 @ 000002bdf90c3c00] use an encoding preset (e.g. -vpre medium) [libx264 @ 000002bdf90c3c00] preset usage: -vpre
-vpre [libx264 @ 000002bdf90c3c00] speed presets are listed in x264 --help [libx264 @ 000002bdf90c3c00] profile is optional; x264 defaults to high This is my code
#pragma warning(disable : 4996) extern "C" { #include
avformat.h> #include opt.h> #include mathematics.h> #include swscale.h> } int main() { av_register_all(); AVFormatContext* formatContext = nullptr; AVOutputFormat* outputFormat = nullptr; AVStream* videoStream = nullptr; const char* filename = "output.mp4"; // Open the output file if (avformat_alloc_output_context2(&formatContext, nullptr, nullptr, filename) < 0) { fprintf(stderr, "Error allocating output format context\n"); return -1; } outputFormat = formatContext->oformat; // Add a video stream videoStream = avformat_new_stream(formatContext, nullptr); if (!videoStream) { fprintf(stderr, "Error creating video stream\n"); return -1; } // Set codec parameters, you may need to adjust these based on your needs AVCodecContext* codecContext = avcodec_alloc_context3(nullptr); codecContext->codec_id = outputFormat->video_codec; codecContext->codec_type = AVMEDIA_TYPE_VIDEO; codecContext->pix_fmt = AV_PIX_FMT_YUV420P; codecContext->width = 640; codecContext->height = 480; codecContext->time_base = { 1, 25 }; // Open the video codec AVCodec* videoCodec = avcodec_find_encoder(codecContext->codec_id); if (!videoCodec) { fprintf(stderr, "Error finding video codec\n"); return -1; } if (avcodec_open2(codecContext, videoCodec, nullptr) < 0) { fprintf(stderr, "Error opening video codec\n"); return -1; } videoStream->codecpar->codec_id = codecContext->codec_id; videoStream->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; videoStream->codecpar->format = codecContext->pix_fmt; videoStream->codecpar->width = codecContext->width; videoStream->codecpar->height = codecContext->height; if (avformat_write_header(formatContext, nullptr) < 0) { fprintf(stderr, "Error writing header\n"); return -1; } // Create a frame AVFrame* frame = av_frame_alloc(); frame->format = codecContext->pix_fmt; frame->width = codecContext->width; frame->height = codecContext->height; av_frame_get_buffer(frame, 32); // Fill the frame with red color for (int y = 0; y < codecContext->height; ++y) { for (int x = 0; x < codecContext->width; ++x) { frame->data[0][y * frame->linesize[0] + x * 3] = 255; // Red component frame->data[0][y * frame->linesize[0] + x * 3 + 1] = 0; // Green component frame->data[0][y * frame->linesize[0] + x * 3 + 2] = 0; // Blue component } } // Write video frames AVPacket packet; for (int i = 0; i < 100; ++i) { // Send the frame for encoding if (avcodec_send_frame(codecContext, frame) < 0) { fprintf(stderr, "Error sending a frame for encoding\n"); return -1; } // Receive the encoded packet while (avcodec_receive_packet(codecContext, &packet) == 0) { // Write the packet to the output file if (av_write_frame(formatContext, &packet) != 0) { fprintf(stderr, "Error writing video frame\n"); return -1; } av_packet_unref(&packet); } } // Write the trailer if (av_write_trailer(formatContext) != 0) { fprintf(stderr, "Error writing trailer\n"); return -1; } // Clean up resources av_frame_free(&frame); avcodec_free_context(&codecContext); avformat_free_context(formatContext); return 0; }