Newest 'x264' Questions - Stack Overflow
Les articles publiés sur le site
-
Compile FFMPEG + x264 - undefined references
6 février 2019, par tishuI have been trying to find a solution online for a couple of days with no luck. I am using Ubuntu and trying to compile the latest FFMPEG stable version (1.0.1) with x264 support. I made sure I uninstalled any existing x264 then I downloaded the latest x264 source and compiled it with the following config:
./configure --prefix=$PREFIX \ --enable-shared \ --enable-static \ --disable-gpac \ --extra-cflags=" -I$ARM_INC -fPIC -DANDROID -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -DANDROID -Wa,--noexecstack -MMD -MP " \ --extra-ldflags=" -nostdlib -Bdynamic -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,nocopyreloc -Wl,-soname,/usr/lib/libz.so -Wl,-rpath-link=$ARM_LIB,-dynamic-linker=/system/bin/linker -L$ARM_LIB -lc -lm -ldl -lgcc" \ --cross-prefix=${ARM_PRE}- \ --disable-asm \ --host=arm-linux \ make clean make install
All goes well, and I checked the installed version:
x264 -V x264 0.129.x built on Dec 27 2012, gcc: 4.6.1 configuration: --bit-depth=8 --chroma-format=all x264 license: GPL version 2 or later
I then try to compile FFMPEG with the following options:
./configure --target-os=linux \ --enable-libx264 \ --enable-gpl \ --prefix=$PREFIX \ --extra-cflags="-I/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/android/armv7-a/include -I/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/x264 -O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -Dipv6mr_interface=ipv6mr_ifindex -fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing -finline-limit=300 $OPTIMIZE_CFLAGS " \ --extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/android/armv7-a/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog" \ --enable-cross-compile \ --extra-libs="-lgcc" \ --arch=arm \ --cc=$PREBUILT/bin/arm-linux-androideabi-gcc \ --cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \ --nm=$PREBUILT/bin/arm-linux-androideabi-nm \ --sysroot=$PLATFORM \
The configure and make clean/make install work well, but when I try to create the .so file the following command fails:
/home/tishu/Apps/android-ndk-r8d/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-ld -rpath-link=./android/armv7-a/usr/lib -L/home/tishu/Apps/android-ndk-r8d/platforms/android-14/arch-arm/usr/lib -soname libffmpeg.so -shared -nostdlib -z,noexecstack -Bsymbolic \ --whole-archive --no-undefined -o ./android/armv7-a/libffmpeg.so libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a -lc -lm -lz -ldl -llog \ --warn-once \ --dynamic-linker=/system/bin/linker /home/tishu/Apps/android-ndk-r8d/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a
This fails with the following output:
libavcodec/libavcodec.a(libx264.o): In function `X264_frame': /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:159: undefined reference to `x264_picture_init' /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:179: undefined reference to `x264_encoder_reconfig' /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:190: undefined reference to `x264_encoder_encode' /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:196: undefined reference to `x264_encoder_delayed_frames' libavcodec/libavcodec.a(libx264.o): In function `encode_nals': /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:101: undefined reference to `x264_bit_depth' libavcodec/libavcodec.a(libx264.o): In function `X264_close': /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:231: undefined reference to `x264_encoder_close' libavcodec/libavcodec.a(libx264.o): In function `X264_init': /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:284: undefined reference to `x264_param_default' /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:292: undefined reference to `x264_param_default_preset' /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:314: undefined reference to `x264_param_parse' /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:459: undefined reference to `x264_param_apply_fastfirstpass' /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:490: undefined reference to `x264_param_apply_profile' /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:533: undefined reference to `x264_encoder_open_129' /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:544: undefined reference to `x264_encoder_headers'
The x264 version it is looking for (129) is the one installed and compiled succesfully with --eanable-shared. Obviously all compiles fine when I do not include libx64.
Question: How can I specify the include path for the last command? I tried adding the path to $PATH and also adding this as an argument with no luck: -I/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/x264
Thanks
-
HLS with FFmpeg (separated track sync)
30 janvier 2019, par PhilGI'm looking for a solution to proceed transcoding a video file to HLS multi-bitrate with audio track separated
basically, I got a video file, I transcoded it into 4 resolutions + 1 audio track
- 180p
- 360p
- 720p
- 1080p
- 2160p (maybe)
- Audio1
- Audio2 (maybe)
but for the exemple, here is my 180p command:
ffmpeg -i ${source} \ -pix_fmt yuv420p \ -c:v libx264 \ -b:v 230k -minrate:v 230k -maxrate:v 230k -bufsize:v 200k \ -profile:v baseline -level 3.0 \ -x264opts scenecut=0:keyint=75:min-keyint=75 \ -hls_time 3 \ -hls_playlist_type vod \ -r 25 \ -vf scale=w=320:h=180:force_original_aspect_ratio=decrease \ -an \ -f hls \ -hls_segment_filename ../OUT/${base_name}/180p/180p_%06d.ts ../OUT/${base_name}/180p/180p.m3u8
and the audio track:
ffmpeg -i ${source} \ -vn \ -c:a aac \ -b:a 128k \ -ar:a 48000 \ -ac:a 2 \ -hls_time 3 \ -hls_playlist_type vod \ -hls_segment_filename ../OUT/${base_name}/audio1/audio1_%06d.ts ../OUT/${base_name}/audio1/audio1.m3u8
for convenient reason, I launch separate ffmpeg command for each resolution, depending on the video source quality
Then I create a standard Master Playlist
#EXTM3U #EXT-X-VERSION:3 #EXT-X-STREAM-INF:BANDWIDTH=230000,RESOLUTION=320x180,CODECS="avc1.42001e" 180p/180p.m3u8 #EXT-X-STREAM-INF:BANDWIDTH=600000,RESOLUTION=640x360,CODECS="avc1.42e00a" 360p/360p.m3u8 #EXT-X-STREAM-INF:BANDWIDTH=3150000,RESOLUTION=1280x720,CODECS="avc1.4d0028" 720p/720p.m3u8 #EXT-X-STREAM-INF:BANDWIDTH=5000000,RESOLUTION=1920x1080,CODECS="avc1.4d0029" 1080p/1080p.m3u8 #EXT-X-STREAM-INF:BANDWIDTH=128000,CODECS="mp4a.40.2" audio1/audio1.m3u8
When I try to read the Master Playlist, I don't have any sound Using VLC, the audio track is played before the video tracks
So, How Can I sync Audio track with Video Tracks ?
Thanks
-
Create an mp4 container for h264 in C or C++ [closed]
30 janvier 2019, par PerracoLabsI've successfully been able to encode h264 streams by using the videolan x264 codec in Android NDK. Now I'm searching for a muxer that can create the mp4 container to hold the resulting stream and make it playable. Is there any small portable C or C++ library that can be used in Android NDK to perform such a task?
-
How to deal ffplay bein too slow playing iPhone's videos ?
21 janvier 2019, par Mikhail T.Trying to play a 3840x2160 video recorded by an iPhone 7 (@30fps), I get frequent pauses -- in the video, music keeps playing.
This happens both in firefox and when
ffplay
is invoked to play the file directly -- from command-line. The CPU is a dual E6700 @3.20GHz -- not super fast, but it should be able to play smoothly, shouldn't it? Video is Intel's "series 4" integrated chipset -- again, not a speed-daemon, but it should be adequate... Support for Intel's VA API is included.I build ffmpeg-4.1 from source using FreeBSD port. As you can see, the port has a maddening amount of options -- including several different ones for the 264-codec.
Any suggestions for improving the decoding speed to the point, where it is watchable by a human? Thank you!
-
Pass ID3D11Texture2D back buffer to libx264 encoder
17 janvier 2019, par Chris SixsmithI'm writing a C++ program to encode frames from a DirectX game to the H.264/MPEG-4 AVC format. I am using libx264 alone with no other dependencies at the moment.
I have a
ID3D11Texture2D*
resolved back buffer of the next game frame. I need to somehow copy this into thex264_picture
input (apparently YUV420P format according to limited help I've found) but I cannot find any way to do so online.Here is my code at the moment:
void Fx264VideoEncoder::Fx264VideoEncoderImpl::InitFrameInputBuffer(const FTexture2DRHIRef& BackBuffer, FFrame& Frame) { x264_picture_alloc(Frame.InputPicture, X264_CSP_I420, x264Parameters.i_width, x264Parameters.i_height); // We need to take the back buffer and convert it to an input format that libx264 can understand { ID3D11Texture2D* ResolvedBackBufferDX11 = (ID3D11Texture2D*)(GetD3D11TextureFromRHITexture(Frame.ResolvedBackBuffer)->GetResource()); EPixelFormat PixelFormat = Frame.ResolvedBackBuffer->GetFormat(); // ...? } }