Closed thegabriele97 closed 3 months ago
The conversion should succeed
It doesn't because the input file name is the same as the output (I want to convert an mp4 to an mp4 but with some ffmpeg flags to reduce size)
The command generated by the flow: ffmpeg -threads 0 -i /tmp/oc_tmp_X8VJCl-.mp4 -y -movflags use_metadata_tags -vcodec libx264 -crf 30 /tmp/oc_tmp_X8VJCl-.mp4
ffmpeg -threads 0 -i /tmp/oc_tmp_X8VJCl-.mp4 -y -movflags use_metadata_tags -vcodec libx264 -crf 30 /tmp/oc_tmp_X8VJCl-.mp4
The log:
[workflow_media_converter] Error: [Symfony\Component\Process\Exception\ProcessFailedException] :: (0) :: The command "ffmpeg -threads 0 -i /tmp/oc_tmp_X8VJCl-.mp4 -y -movflags use_metadata_tags -vcodec libx264 -crf 30 /tmp/oc_tmp_X8VJCl-.mp4" failed. Exit Code: 1(General error) Working directory: /var/www Output: ================ Error Output: ================ ffmpeg version 4.3.6-0+deb11u1 Copyright (c) 2000-2023 the FFmpeg developers built with gcc 10 (Debian 10.2.1-6) configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/oc_tmp_X8VJCl-.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp41isom creation_time : 2023-09-27T13:17:14.000000Z Duration: 00:01:13.19, start: 0.000000, bitrate: 1157 kb/s Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 1058 kb/s, 24.90 fps, 25 tbr, 25k tbn, 50 tbc (default) Metadata: creation_time : 2023-09-27T13:17:14.000000Z handler_name : VideoHandler encoder : AVC Coding Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 95 kb/s (default) Metadata: creation_time : 2023-09-27T13:17:14.000000Z handler_name : SoundHandler Output /tmp/oc_tmp_X8VJCl-.mp4 same as Input #0 - exiting FFmpeg cannot edit existing files in-place. :: #0 /var/www/nextcloud/apps/workflow_media_converter/lib/BackgroundJobs/ConvertMediaJob.php(67): OCA\WorkflowMediaConverter\BackgroundJobs\ConvertMediaJob->convertMedia() #1 /var/www/nextcloud/lib/public/BackgroundJob/Job.php(81): OCA\WorkflowMediaConverter\BackgroundJobs\ConvertMediaJob->run() #2 /var/www/nextcloud/lib/public/BackgroundJob/QueuedJob.php(57): OCP\BackgroundJob\Job->start() #3 /var/www/nextcloud/lib/public/BackgroundJob/QueuedJob.php(47): OCP\BackgroundJob\QueuedJob->start() #4 /var/www/nextcloud/cron.php(152): OCP\BackgroundJob\QueuedJob->execute() #5 {main} at 2024-05-02T15:20:03+00:00
the flow settings:
EDIT: https://github.com/cwilby/nextcloud-workflow-media-converter/blob/54268e4f0cd20d8e6ed15e5e2460943347018cf5/lib/BackgroundJobs/ConvertMediaJob.php#L116
Maybe something like that can be done
$this->tempOutputPath = str_replace(".{$this->sourceExtension}", "_out_.{$this->outputExtension}", $this->tempSourcePath);
Steps to reproduce
Expected behaviour
The conversion should succeed
Actual behaviour
It doesn't because the input file name is the same as the output (I want to convert an mp4 to an mp4 but with some ffmpeg flags to reduce size)
The command generated by the flow:
ffmpeg -threads 0 -i /tmp/oc_tmp_X8VJCl-.mp4 -y -movflags use_metadata_tags -vcodec libx264 -crf 30 /tmp/oc_tmp_X8VJCl-.mp4
The log:
the flow settings:
EDIT: https://github.com/cwilby/nextcloud-workflow-media-converter/blob/54268e4f0cd20d8e6ed15e5e2460943347018cf5/lib/BackgroundJobs/ConvertMediaJob.php#L116
Maybe something like that can be done