Newest 'x264' Questions - Stack Overflow
Les articles publiés sur le site
-
x264enc not respecting timestamps
23 mai 2015, par Austin A.I am trying to write a gstreamer pipeline to read video from a FIFO on disk as raw 720p RGB images, then encode the frames using x264, and save an .mkv file to disk. Here is my current pipeline:
gst-launch-1.0 --eos-on-shutdown -v \ filesrc location="/path/to/fifo_name" do-timestamp=true \ ! videoparse format="GST_VIDEO_FORMAT_RGB" width="1280" height="720" \ framerate="2997/100" \ ! videoconvert \ ! "video/x-raw, format=(string)I420, width=(int)1280,\ height=(int)720" \ ! videorate \ ! "video/x-raw,framerate=(fraction)2997/100" \ ! x264enc \ ! matroskamux name=mux \ ! filesink location=/path/to/output.mkv sync=false
The frames are normally pushed onto the fifo at a regular rate (29.97 fps), but sometimes there will be a dropped frame or two, so there might be a delay of 66ms or 100ms between adjacent frames instead of the regular 33ms. However, the
x264enc
element is not respecting those timestamps, because it gives each frame the same 33ms duration, and skips over those dropped frames without the appropriate delay. This makes the video play back faster than expected.To test that this was indeed the
x264enc
element causing issues, I tried skipping the encoder and just showing the result in a display, and this puts the correct delays into the video:gst-launch-1.0 --eos-on-shutdown -v \ filesrc location="/path/to/fifo_name" do-timestamp=true \ ! videoparse format="GST_VIDEO_FORMAT_RGB" width="1280" height="720" \ framerate="2997/100" \ ! videoconvert \ ! "video/x-raw, format=(string)I420, width=(int)1280,\ height=(int)720" \ ! videorate \ ! "video/x-raw,framerate=(fraction)2997/100" \ ! xvimagesink sync=false
So, something about the x264 encoder is not respecting the timestamps it's given.
According to the x264 options page, I can provide my own timestamps in a file and give it to x264 with a '
tcfile-in
' parameter. But when I try to pass that in throughx264enc
'soption-string
parameter as! x264enc option-string="tcfile-in=/path/to/timestamp.txt"
I get a
Bad name for option tcfile-in=/path/to/timestamp.txt
error.
Any ideas?
-
Unrecognized option 'c:v' ffmpeg error for converting videos to H264
16 mai 2015, par user3528346I told my server to upgrade to latest version of ffmpeg and they told me they did and I have the latest version that is 2.2.1 . I test several codes to convert a video to x264 , here is the one ;
passthru("$ffmpegpath -i aatest/a.AVI -c:v libx264 -c:a libfaac -preset veryslow -qp 0 aatest/output.mp4 2>&1");
the result
FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers built on Jan 29 2012 17:52:15 with gcc 4.4.5 20110214 (Red Hat 4.4.5-6) configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --enable-avfilter --enable-avfilter-lavf --enable-libdc1394 --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab libavutil 50.15. 1 / 50.15. 1 libavcodec 52.72. 2 / 52.72. 2 libavformat 52.64. 2 / 52.64. 2 libavdevice 52. 2. 0 / 52. 2. 0 libavfilter 1.19. 0 / 1.19. 0 libswscale 0.11. 0 / 0.11. 0 libpostproc 51. 2. 0 / 51. 2. 0 [mpeg4 @ 0x1111960]Invalid and inefficient vfw-avi packed B frames detected [mpeg4 @ 0x1111960]frame skip 8 Input #0, avi, from 'aatest/a.AVI': Duration: 00:02:04.04, start: 0.000000, bitrate: 885 kb/s Stream #0.0: Video: mpeg4, yuv420p, 480x360 [PAR 4:3 DAR 16:9], 25 tbr, 25 tbn, 25 tbc Stream #0.1: Audio: mp3, 44100 Hz, 2 channels, s16, 128 kb/s Unrecognized option 'c:v'
the last line says "Unrecognized option 'c:v'"
What should I do ? Thanks
-
OpenCV : File Size of H.264 encoded videos
12 mai 2015, par limekilnI write a program that creates a video file out of an image sequence using OpenCV. It runs fine and does what it should, but I realized something I can't explain. My Videowriter looks like this:
VideoWriter video(name + ".avi", CV_FOURCC(FOURCC[0], FOURCC[1], FOURCC[2], FOURCC[3]), fps, cvSize((int)width, (int)height)); for (;;) { capture >> frame; if (frame.empty()) break; if (!frame.data) { cerr << "Could not retrieve frame."; return -1; } video << frame; }
For compression, I use either "MJPG", "M4S2" (some MPEG-4 codec) or "X264" (a H.264 codec). I'm getting the "fps" value by user input. Everything works fine, but I found that the output file of X264 encoded videos scales with the fps, the higher the fps the smaller the output file. For the other 2 the size remains the same, just the length of the video changes (as I would expect since it should have the same number of frames, just in another amount of time). Can anyone explain me why the file size changes using X264 here?
-
X264 Error message when capturing video
2 mai 2015, par savI'm writing a program to save some webcam video to a file. I'm using the x264 codec found here x264
When I try writing frames to a file I get this error message poping up.
x264vfw [warning]: Few frames probably would be lost. Ways to fix this:
x264vfw [warning]: -if you use VirtualDub or its fork than you can enable 'VirtualDub Hack' option
x264vfw [warning]: -you can enable 'File' output mode
x264vfw [warning]: -you can enable 'Zero Latency' option
I found this VirtualDub Hack but then I'm not using virtual dub. I'm not sure what the File output mode and zero latency mean.
I think the problem is related to the codec since when I change to using a different codec, everything works fine. I'm using C# and emgu but I dont think thats where the problem lies.
EDIT
In case the code helps
public static void StartCapture() { try { capture = new Capture(); capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_WIDTH, 1920); //1920 capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT, 1080); //1080 CaptureOutput = new VideoWriter ( "capture output.avi", CvInvoke.CV_FOURCC('X','2','6','4'), 50, //fps (int)capture.GetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_WIDTH), (int)capture.GetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT), true ); if (capture != null) { capture.ImageGrabbed += SaveFrame; capture.Start(); } } catch (Exception e) { MessageBox.Show(e.ToString()); } } static void SaveFrame(System.Object sender, EventArgs e) { Image video; video = capture.RetrieveBgrFrame(); CaptureOutput.WriteFrame(video); }
-
Windows : can't generate libx264.dll because MinGW : no working c compiler found
27 avril 2015, par Sandie CIt's my first post in a forum ever (and in english...) Any suggestion is welcomed.
So let's started !
My global goal is to recorder/transcoding and display an IP Camera stream from a .bat whitch calling vlc. (I tried before doing it with VLC interface and it's going well. I don't understand why the encoder is missing using that way)
I want an asf container containing h264 and aac.
.bat :
cd C:\Program Files (x86)\VideoLAN\VLC
vlc rtsp://root:root@ip_adresse/media.amp --sout "#transcode{ vcodec=x264, vb=112 , acodec==aac, fps=25}:duplicate{dst=display,dst=standard{access=file,mux = asf,dst=flux.asf}" -v
when I first execute this, VLC told me that H264 encoder was not found, so I decided to compile x264.
I used this link
http://www.ayobamiadewole.com/Blog/How-to-build-x264-or-libx264.dll-in-Windows
I succeed to make the .exe but and when I got to
./configure --disable-cli --enable-shared --extra-ldflags=-Wl,--output-def=libx264.def
minGW shell indicates : no working c compiler found
I find some answer, but i didn't found the good one.
Does anyone have an idea of what i'm doing wrong ?
Is it possible that my gcc (4.6) is not the good one ? What should I do ?
Need another advice : When I would have this libx264.ddl where should I put it to make my script working ?
Early thanks for your answers.