I try to concatenate two videos using ffmpeg I use that wrapper: wrapper.
According docs I use this commands :
ffmpeg -i input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
ffmpeg -i input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
ffmpeg -i concat:"intermediate1.ts|intermediate2.ts" -c copy -bsf:a aac_adtstoasc output.mp4
After two command I got two files:
/storage/emulated/0/recorder/test1_convert.ts /storage/emulated/0/recorder/test2_convert.ts
But when I execute the third command I got failure: log message: concat:"/storage/emulated/0/recorder/test1_convert.ts|/storage/emulated/0/recorder/test2_convert.ts": No such file or directory
I suppose something wrong with syntax absolute path. This is full my third command:
Remove the double-quotes in the concat line.
I am not an Android user but quoting seems to be a typical problem on Android when using ffmpeg.
Related
I am running following command to extract audio from videos and merge them into a single file:
-y -hide_banner -i /storage/emulated/0/Videos/video_4.mp4 -i /storage/emulated/0/WhatsApp/Media/WhatsApp Video/VID-20210430-WA0010.mp4 -i /storage/emulated/0/WhatsApp/Media/WhatsApp Video/VID-20210430-WA0052.mp4 -filter_complex [0:a]atrim=duration=1119.028,volume=1[a_0];[1:a]atrim=duration=84.057,volume=1[a_1];[2:a]atrim=duration=278.029,volume=1[a_2];[a_0][a_1][a_2]concat=n=3:v=0:a=1[audio] -map [audio] -acodec aac -vn /storage/emulated/0/Videos/audio.aac
But ffmpeg says
/storage/emulated/0/Videos/video_4.mp4: No such file or directory
I can ensure that the file exist on that specified path. What might cause the issue?
Note: The same error occures for some other comands too, but in all the cases the video file exist in the specified path.
I had the same problem, I installed it using snap.
So, as a solution, I tried uninstalling using remove and purge, and then I used mv /snap/bin/ffmpeg /snap/bin/ffmpeg_old.
Then I installed using apt-get install ffmpeg, and worked. I guess the problem was the version of ffmpeg.
I am using ffmpeg in android for create video from multiple images, it has done and now i want to add more images in generated video. i found many times but not getting any proper command in ffmpeg for that.please help
Try using this command,
1.
ffmpeg -y -framerate 1/2 -start_number 1 -i img/%1d.jpg -vf scale=720:756 -c:v libx264 -r 10 -pix_fmt yuv420p videos.mp4
If you want to add watermark image to your generated video, you can use this one:
2.
ffmpeg -i videos.mp4 -i watermark_img.jpg -filter_complex "overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" -codec:a copy watermark_videos.mp4
In order to create video from random images, You have to keep all images in dir called img, as you can see in first command, and just name all images in the dir, like: 1.jpg,2.jpg...N.jpg,etc , you have to name all the images in sequential number format, which is required by the ffmpeg command as you can see in the first command -i img/%1d.jpg , here -start_number 1 indicates it should start from image preceding with 1 number, and go on with all the images stored in img/ dir, sequentially.
In order to understand the ffmeg command please read all of it's CLI parameters:
man ffmpeg
OR
ffmpeg --help
I want use images to generate a video, i found a ffmpeg command option name '-f concat' ,anybody can give me more infomations?
i try like this:
ffmpeg -r 1/5 -s 480*480 -f concat -safe 0 -i test/b.txt -c:v libx264 test/test.mp4
but an error appear:
Option video_size not found.
I am cutting out segments from a long mp4 file and then rejoining parts of them. However, since FFMPEG apparently keeps the same MOOV atom for the trimmed files as the original, it looks to FFMPEG that the trimmed videos are all identical since they all have the same MOOV atom, and therefore only uses the first segment when trying to join the videos. Is there a way around this? Unfortunately since FFMPEG is embedded in an Android app, I can only use version 0.11.
Edit:
This is a sample of the processes:
ffmpeg -i /sdcard/path/movie.mp4 -ss 00:00:06.000, -t 00:00:05.270, -c:a aac -c:v libx264 /sdcard/path/file1.mp4
ffmpeg -i /sdcard/path/movie.mp4 -ss 00:00:12.000, -t 00:00:04.370, -c:a aac -c:v libx264 /sdcard/path/file2.mp4
ffmpeg -i /sdcard/path/movie.mp4 -ss 00:00:23.000, -t 00:00:03.133, -c:a aac -c:v libx264 /sdcard/path/file3.mp4
ffmpeg -i "concat:/sdcard/path/file1.mp4|/sdcard/path/file2.mp4|/sdcard/path/file3.mp4" -c:a aac -c:v libx264 /sdcard/path/output.mp4
I've also tried using the copy codec option but that hasn't helped.
Can you try something like:
ffmpeg -i input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
ffmpeg -i input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
ffmpeg -i "concat:intermediate1.ts|intermediate2.ts" -c copy -bsf:a aac_adtstoasc output.mp4
I hope this works with ffmpeg version 0.11. We need to make sure you can concat before applying the cut of file.
Also can you check the intermediary file*.mp4 works well? Can you try to put your video files on the same folder as ffmpeg I am not sure how the concat protocol reacts to /sdcard/path/file1.mp4|/sdcard/path/file2.mp4?
I am working on add watermark on video file in android with the use of ffmpeg jni what i have not found any solution for the same . i am using this command "ffmpeg -i alldone.mp4 -i cancel_bttn.png -filter_complex "overlay=main_w/2-overlay_w/2:main_h/2-overlay_h/2" record.mp4 " but this was not worked.