Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Wrong path returned from MPV player using mp.get_property("path") spaces on Windows
15 août 2018, par user2432166I have my video in the following locaton with spaces on Windows.
"c:\GoogleDrive\CMD Scripts_video\test.mp4"
MPV function in Lua script returns cut path with special characters ~1
video_path = mp.get_property("path")
"c:\GOOGLE~1\CMDSCR~1_video\test.mp4"
How can I get on Windows full path to use it as input for FFMPEG in my LUA script?
Thank you Peter
-
User custom private in AVPacket
15 août 2018, par stuhloIs there a way to attach some user private data to
AVPacket
before decoding to be able to match inputAVPacket
and decoded outputAVFrame
? Some sort ofAVFrame::opaque
.Specifically, decoding process of h264 codestream can do reorder in a case B-frames are present and I would like to identify which
AVPacket
was decoded to whichAVFrame
. -
using libavcodec to decode video to YUV422
15 août 2018, par rafi wienerI want to write a C++ application that opens a mp4 file and decode it as a yuv422 file. I wrote some code based on libavcodec tutorial but I couldn't find the place to set the bit depth and the format to YUV422.
here is the some of the code i wrote
void read_video_stream(AVFormatContext *pFormatContext, AVCodec *pCodec, AVCodecParameters *pCodecParameters, int video_stream_index) { AVCodecContext *pCodecContext = avcodec_alloc_context3(pCodec); std::unique_ptr ctx_guard(pCodecContext); if (!pCodecContext) { return; } if (avcodec_parameters_to_context(pCodecContext, pCodecParameters) < 0) { return; } // i tried setting it here if (avcodec_open2(pCodecContext, pCodec, NULL) < 0) { return; } while (true) { std::unique_ptr> packet{ new AVPacket, [](AVPacket* p){ av_packet_unref(p); delete p; }}; av_init_packet(packet.get()); int response = av_read_frame(pFormatContext, packet.get()); if (AVERROR_EOF == response) { std::cout << "EOF\n"; } else if (response < 0) { std::cout << "Error " << response; return; } if (packet->stream_index != video_stream_index) { continue; } response = avcodec_send_packet(pCodecContext, packet.get()); if (response < 0) { std::cout << "Error while sending a packet to the decoder: " << response; return; } while (response >= 0) { std::shared_ptr
pFrame{ av_frame_alloc(), AVFrameDeleter}; response = avcodec_receive_frame(pCodecContext, pFrame.get()); if (response == AVERROR(EAGAIN)) { continue; } if (response == AVERROR_EOF) { std::cerr << "got to last frame\n"; return; } else if (response < 0) { std::cerr << "Error while receiving a frame from the decoder: " << response; return; } if (response >= 0) { // copy line to cyclic buffer cb.push_back(std::move(pFrame)); } } } } my end goal is to send the uncompressed data (need to be in pFrame->data[0-2]) to a device in the network. can you please help me with this issue thanks
-
compiling ffmpeg with nvidia/cuda failed loading nvcuvid
15 août 2018, par jupiarI am trying to compile an ffmpeg binary with support for using nvidia GPU's, I am running:
os: ubuntu 18.04 nvidia driver: nvidia-driver-390 cat /usr/local/cuda-9.0/version.txt => CUDA Version 9.0.176 gpu: 2x 1080ti
With the instructions shown on https://developer.nvidia.com/ffmpeg, being:
git clone https://git.ffmpeg.org/ffmpeg.git cd ffmpeg ./configure --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64
I first found the error
ERROR: cuda requested, but not all dependencies are satisfied: ffnvcodec
, which was solved with help from https://superuser.com/questions/1299064/error-cuvid-requested-but-not-all-dependencies-are-satisfied-cuda-ffnvcodec. Below is the summary (make and make install just gave a list of commands to run):git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git cd nv-codec-headers sed 's#@@PREFIX@@#/usr/local#' ffnvcodec.pc.in > ffnvcodec.pc sudo install -m 0755 -d '/usr/local/include/ffnvcodec' sudo install -m 0644 include/ffnvcodec/*.h '/usr/local/include/ffnvcodec' sudo install -m 0755 -d '/usr/local/lib/pkgconfig' sudo install -m 0644 ffnvcodec.pc '/usr/local/lib/pkgconfig'
With that done, I removed the ffmpeg folder, recloned it and ran within the folder:
./configure --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda-9.0/include --extra-ldflags=-L/usr/local/cuda-9.0/lib64 make -j 10
Note that the path /usr/local/cuda-9.0 does contain both the include and lib64 folders, and that this resulted in no errors, just deprecation warnings.
Now when running this particular ffmpeg binary, with absolute paths, using the flag
-hwaccel cuvid
results in:~/Documents/ffmpeg-cuda/ffmpeg/ffmpeg -y -hwaccel cuvid -c:v h264_cuvid -vsync 0 -i ~/test.mp4 -vf "scale_npp=1920:1072" -vcodec h264_nvenc ~/out1.mp4 -vf scale_npp=1280:720 -vcodec h264_nvenc out2.mp4
Which, is exactly what they have on their website to test it, results in:
[h264_cuvid @ 0x556348eb94c0] Cannot load cuvidGetDecodeStatus [h264_cuvid @ 0x556348eb94c0] Failed loading nvcuvid.
I have also prepended:
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
before./configure
, but also did not make a difference.What am I doing wrong? Is there something important I missed?
-
The same frame of the image, through the same algorithm or library, compression twice after the image is same or not
15 août 2018, par karllenThe same frame of the image, through the same algorithm or library, lossy compression twice, compression twice after the image is same or not ?