New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to save concatenated video #580
Comments
I got the same error on windows. Changing the following line in the library PHP-FFMpeg/src/FFMpeg/Media/Concat.php Line 108 in fc8dbd6
to $line .= "file '" . $videoPath . "'"; fixed the error for me. But I am not sure about the correct escaping. Here the contents of the temp file not working
and here the working version
|
I think I have found the cause. When I am trying to concat using the command line:
I get this error: And that may be because the two video files have audio opus codec. So if I run this commands it works:
The video is properly created as a concatenation of the two videos. Do you know how can change the code, in order to convert the output file to aac? |
Not supported directly, yet. Although it sounds very decent for a new version(1.x). |
Thanks for replying @jens1o. I am now try a simple concat using two files mp4 with aac audio codec. It should work but it doesn't :(
Do you know why? What can be the reason ffmpeg cannot execute the command? |
Please send us the hole output of |
This is the output:
This is what happen inside the folder Something is being created and deleted soon afterwards |
Okay, more debugging here. Could you give me a full list of files(with their respective filepath) you want to concat? |
If I can exclude with certainty some reasons for the failure I would say:
What else can be? In the composer.json of that bundle, the PHP-FFMpeg library is included as following:
Is that correct? I am not sure which version is that.. |
And actually this is the whole code:
|
The issue has been finally been resolved! The problem was that I totally misunderstood about the output file. That was the reason why it was failing... If the output doesn't exists then everything works perfectly!! Thank you very much for your time and sorry for trivial error! By the way is it possible to improve that error message in the source code.
Something like that. If is possible would be great! |
Great! Yeah, giving users a hint what could have failed is on track #310 :) |
Ah great! That will be perfect! |
If anyone is still encountering this problem (on Window at least), consider the following code : // Creating the files to work with
// $this->storage --> \Illuminate\Support\Facades\Storage::disk('testing')
if (!$this->storage->exists('ffmpeg/file-to-concat-1.mp4')) {
$this->storage->copy('ffmpeg/some-file.mp4', 'ffmpeg/file-to-concat-1.mp4');
}
if (!$this->storage->exists('ffmpeg/file-to-concat-2.mp4')) {
$this->storage->copy('ffmpeg/some-file.mp4', 'ffmpeg/file-to-concat-2.mp4');
}
if (!$this->storage->exists('ffmpeg/file-to-concat-3.mp4')) {
$this->storage->copy('ffmpeg/some-file.mp4', 'ffmpeg/file-to-concat-3.mp4');
}
$basePath = storage_path('app/testing/ffmpeg');
// $this->ffmpeg --> \Pbmedia\LaravelFFMpeg\FFMpegFacade
$this->ffmpeg::fromDisk('testing')->open('ffmpeg/file-to-concat-1.mp4')
->concat([
str_replace('\\', '/', $basePath . '/file-to-concat-2.mp4'),
str_replace('\\', '/', $basePath . '/file-to-concat-3.mp4')
])
->saveFromSameCodecs(str_replace('\\', '/', $basePath . '/' . time() . '-concatenated-file.mp4'), true); The important things to note here are :
Explication My code kept throwing the "Unable to save concatenated video" error and it was impossible to figure out why from the this PHP package side of things. So I in my terminal I had to reproduce what the Concat.php#L82 was doing, which is (for those too lazy to read the code) : file C:/[...]/file-to-concat-2.mp4
file C:/[...]/file-to-concat-3.mp4 replacing all the And finally running the command :
After some trials and errors I adapted my code to one that finally work as posted above. Oh and yeah, make sure the output file does not exist otherwise you'll get an other error. Hope it helps 👌 |
Actual Behavior
I am trying to concat two videos, but I am getting the following error:
ffmpeg failed to execute command '/usr/local/bin/ffmpeg' '-f' 'concat' '-safe' '0' '-i' '/private/var/folders/dw/919v2nds7s78pz_qhp7z9rcm0000gn/T/ffmpeg-concateaHp0L' '-c' 'copy' '/Users/francescomussi/Desktop/Apps/cameraProject/back-end/camera-laravel/storage/app/public/videos/output.mp4'
This is a dump of the commands:
Expected Behavior
I expected the command to be executed.
Steps to Reproduce
For the code I am following the docs:
EDIT:
I have tried a basic resizing and conversion and it worked fine.
So it should everything alright with the installation of the library and the installation of FFMpeg in the system.
So it may be just related with some details concerning the concat.
EDIT2:
I have opened a SO question: https://stackoverflow.com/questions/52593866/php-ffmpeg-how-to-properly-concatenate-two-videos
And it seems that another user (this time on windows) encounter the same issue.
Could you please be so kind to test if the concat function it is still working properly?
Thanks!
The text was updated successfully, but these errors were encountered: