Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
How to use ffmpeg to convert a flac file to alac and preserving all metadatas ?
24 mai, par AxZxPI use this loop to convert flac to alac :
for i in *.flac; do ffmpeg -i "$i" -y -vn -c:a alac "${i%.flac}".m4a; done
But some tags are not exported. I tried to use the
-map_metadata 0 -id3v2_version 2
flag but it does not change anything.Here you can find the tags that are copied (with or without the
-map_metadata
) : original tagsWhen I use XLD Mac software it works perfectly but for some reasons I'd like to use CLI to convert flac files.
-
How to achieve real time video editing on Android ?
24 mai, par ItamarI've been working recently on a video-editing-related project on Android, and am desperately looking for resources related to video editing on the platform.
The only video-editing related "method" or information I could find was using the FFmpeg library, which is pretty rich in features and capabilities but works really slow, operations such as reversing a 10-second video can take as long as 30 seconds, which delivers a really poor user experience.
That being said, it seems that there are tons of Android video-editing apps that are capable of doing everything FFmpeg can, only in almost immediate periods of time (apps such as InShot, PocketVideo or even the previous musical.ly TikTok).
I've tried researching and searching for information on the topic in almost any reasonable place (Google, GitHub, YouTube, the Android developer center, and even on "support" pages of the above-mentioned apps) to no avail (no explanatory documents, no open source libraries, not even demo apps), if anyone could shed some light on the subject that would be much, much appreciated!
Thanks.
-
How to convert .fbx to frame images
24 mai, par Ittefaq TechnologiesI wanna to need help that i wanna to convert .fbx to video through script and i found a soluotion to do it through FFmpeg but it not supports .fbx so i need help in to get frame images so i can make video through ffmpeg or if i am goin in wrong direction you can help me
I tried to convert a .fbx file to .obj using three.js and then create a video from the .obj file, but it didn't work.
<script>
 // Function to load FBX using FBXLoader
 function loadFBX(blob, loader, callback) {
 var url = URL.createObjectURL(blob);
 loader.load(url, function(object) {
 callback(object);
 });
 }

 // Function to export THREE.Object3D to OBJ format using OBJExporter
 function exportToOBJ(object, callback) {
 var exporter = new THREE.OBJExporter();
 var result = exporter.parse(object);
 callback(result);
 }

 // Function to send OBJ file to PHP script
 function sendToPHP(objBlob, fileName) {
 var formData = new FormData();
 formData.append('objFile', objBlob, fileName);

 var xhr = new XMLHttpRequest();
 xhr.open('POST', 'convert.php', true);
 xhr.onload = function() {
 if (xhr.status === 200) {
 console.log('Conversion successful:', xhr.responseText);
 } else {
 console.error('Conversion failed:', xhr.responseText);
 }
 };
 xhr.send(formData);
 }

 // Function to convert FBX to OBJ
 function convertToOBJ() {
 var fileInput = document.getElementById('fileInput');
 var file = fileInput.files[0];

 if (file) {
 var reader = new FileReader();
 reader.onload = function(event) {
 var arrayBuffer = event.target.result;
 var blob = new Blob([arrayBuffer]);
 var loader = new THREE.FBXLoader();
 loadFBX(blob, loader, function(object) {
 exportToOBJ(object, function(objText) {
 var objBlob = new Blob([objText], { type: 'text/plain' });
 sendToPHP(objBlob, file.name.split('.')[0] + '.obj');
 });
 });
 };
 reader.readAsArrayBuffer(file);
 } else {
 alert('Please select an FBX file to convert.');
 }
 }
 </script>
<?php // Check if form submitted and file uploaded if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_FILES["objFile"])) { $objFile = $_FILES["objFile"]; $objFilePath = $objFile["tmp_name"]; $outputVideo = 'output.mp4'; // Execute FFmpeg command to convert OBJ to video exec("ffmpeg -i \"$objFilePath\" $outputVideo", $output, $returnCode); if ($returnCode === 0) { echo 'Conversion successful'; } else { echo 'Conversion failed'; } } else { echo 'No OBJ file uploaded'; } ?>
-
avcodec_find_encoder(AV_CODEC_ID_H264) returns null
24 mai, par Monjura RumiI am building an android application which will encode image captured from camera preview and later decode it. I am using ffmpeg library to encode and decode. To build static library with x264 I have used this tutorial. http://dl.dropbox.com/u/22605641/ffmpeg_android/main.html. As a source code of ffmpeg if I use the one downloaded from the link given in tutorial I can built it but can't build library if i use source code downloaded from here git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg. I have built library in ubuntu and using it in windows 7 in Eclipse. As I need only h264 encoder and decoder I have used following code for ffmpeg, slightly modified from tutorial.
#!/bin/bash NDK=~/Documents/android-ndk-r8e PLATFORM=$NDK/platforms/android-8/arch-arm PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86 PREFIX=/home/android-ffmpeg function build_one { ./configure --target-os=linux --prefix=$PREFIX \ --enable-cross-compile \ --enable-runtime-cpudetect \ --disable-asm \ --arch=arm \ --cc=$PREBUILT/bin/arm-linux-androideabi-gcc \ --cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \ --disable-stripping \ --nm=$PREBUILT/bin/arm-linux-androideabi-nm \ --sysroot=$PLATFORM \ --enable-nonfree \ --enable-version3 \ --disable-everything \ --enable-gpl \ --disable-doc \ --enable-avresample \ --disable-ffplay \ --disable-ffserver \ --enable-ffmpeg \ --disable-ffprobe \ --enable-avcodec \ --enable-libx264 \ --enable-encoder=libx264 \ --enable-encoder=libx264rgb \ --enable-decoder=h263 \ --enable-decoder=h264 \ --enable-decoder=svq3 \ --enable-zlib \ --enable-gpl \ --enable-pic \ --disable-devices \ --disable-avdevice \ --extra-cflags="-I/home/android-ffmpeg/include -fPIC -DANDROID -D__thumb__ -mthumb -Wfatal-errors -Wno-deprecated -mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=armv7-a" \ --extra-ldflags="-L/home/android-ffmpeg/lib" make -j4 install $PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o $PREBUILT/bin/arm-linux-androideabi-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -L$PREFIX/lib -soname libffmpeg.so -shared -nostdlib -z,noexecstack -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg.so libavcodec/libavcodec.a libavfilter/libavfilter.a libavresample/libavresample.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a -lc -lm -lz -ldl -llog -lx264 --warn-once --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a } build_one
After building library I have been able to build android ndk. A little part of my JNI code is here.
JNIEXPORT jint JNICALL Java_com_example_testjava_TestjniActivity_initencoder(JNIEnv* env,jobject obj){ av_register_all(); avcodec_register_all(); codec = avcodec_find_encoder(AV_CODEC_ID_H264); if (!codec) { __android_log_write(ANDROID_LOG_INFO, "debug", "not found"); return -1; } . . . }
When I run my java source code that calls initencoder() I get -1 as return value and logcat prints "not found". That means avcodec_find_encoder() returns null and if condition is being ok. I don't know what's wrong. Why this function is returning null? I have searched a lot but did not find any solution that could guide me to right direction. some says to use avcodec_init(). But ndk-build command fails and shows error saying undefined reference to 'avcodec_init()'. I have started with library build because I thought may be I am doing wrong from the first stage. Did I make any mistake in library building like not enabling things that I should? Please help me here. This is kind of urgent for me.
-
I use ffmpeg to encode and create MPEG file from a source MP4 file. In Mac the encoding is good but in windows it creates random green pixels [closed]
24 mai, par Amudhan RI use ffmpeg 3.4.2 version to encode and create an MPEG-TS file using H.264 encoding. In both Windows and Mac the ffmpeg creates the video without any error. But the resultant video from windows having a green pixels on certain frames. No idea why this is happening.
Below is the encoding command:
ffmpeg -i VIDEO_SOURCE.mp4 -vf scale=720:480 -c:v libx264 -b:v 2M -minrate 2M -maxrate 2M -bufsize 2M -level:v 40 -profile:v main -bf:v 2 -r 30 -crf 22 -x264-params 'keyint=3:min-keyint=3:ref=2:8x8dct=0:weightp=1:subme=6:rc-lookahead=30' -c:a aac -b:a 130k -ar 48000 -f mpegts -filter_complex alimiter=level_in=1:level_out=1:limit=0.15:attack=7:release=100:level=0 VIDEO_ENCODED.mpeg
But the resultant video from windows having green pixels on certain frames. No idea why this is happening.