transitive-bullshit / ffmpeg-concat

Concats a list of videos together using ffmpeg with sexy OpenGL transitions.
893 stars 116 forks source link

Getting concat error Error: ffmpeg exited with code 1: #51

Open javeedrahman opened 5 years ago

javeedrahman commented 5 years ago

Hi, I am trying to run the command from the centos os but i am getting the following error.

1 file was 14 mb and 7 mb, Is there any file restriction or format should i need to pass. Please clarify.

**xvfb-run -s "-ac -screen 0 1280x1024x24" ffmpeg-concat  -t circleopen -d 750 -o opengl/javio.mp4 /home/captionsly/app/media/2/output/1/6990_output.mp4 /home/captionsly/app/media/2/output/1/9622_output.mp4**

{ cmd:
   'ffmpeg -i /home/captionsly/app/media/2/output/1/6990_output.mp4 -y -pix_fmt rgba -start_number 0 /tmp/5500f612fd30bb055a8a1438b88f34ef/scene-0-%012d.raw' }
{ cmd:
   'ffmpeg -i /home/captionsly/app/media/2/output/1/9622_output.mp4 -y -pix_fmt rgba -start_number 0 /tmp/5500f612fd30bb055a8a1438b88f34ef/scene-1-%012d.raw' }
ffmpeg-concat: 57154.073ms
concat error Error: ffmpeg exited with code 1: av_interleaved_write_frame(): Input/output error
frame=  233 fps=4.1 q=-0.0 Lsize=N/A time=00:00:07.77 bitrate=N/A    
video:1887300kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

    at ChildProcess.<anonymous> (/opt/cpanel/ea-nodejs10/lib/node_modules/ffmpeg-concat/node_modules/fluent-ffmpeg/lib/processor.js:182:22)
    at ChildProcess.emit (events.js:198:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
(node:44646) UnhandledPromiseRejectionWarning: Error: ffmpeg exited with code 1: av_interleaved_write_frame(): Input/output error
frame=  233 fps=4.1 q=-0.0 Lsize=N/A time=00:00:07.77 bitrate=N/A    
video:1887300kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

    at ChildProcess.<anonymous> (/opt/cpanel/ea-nodejs10/lib/node_modules/ffmpeg-concat/node_modules/fluent-ffmpeg/lib/processor.js:182:22)
    at ChildProcess.emit (events.js:198:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
(node:44646) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:44646) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
transitive-bullshit commented 5 years ago

Those file sizes should be fine.

Can you run those ffmpeg commands directly and see if ffmpeg throws an error?

ffmpeg -i /home/captionsly/app/media/2/output/1/6990_output.mp4 -y -pix_fmt rgba -start_number 0 "scene-0-%012d.raw"

ffmpeg -i /home/captionsly/app/media/2/output/1/9622_output.mp4 -y -pix_fmt rgba -start_number 0 "scene-1-%012d.raw"

These commands break the input mp4 videos into individual frames and it looks like ffmpeg is complaining that the conversion process is failing. This could be because of some random mp4 formatting issue, but it's impossible to tell without the source mp4 files.

javeedrahman commented 5 years ago

Thank you @transitive-bullshit ,

I am using centos to run those commands as per https://www.npmjs.com/package/gl#how-can-headless-gl-be-used-on-a-headless-linux-machine

When i run these command in ubuntu it render fine. Is there any options need to be changed in xvfb-run -s "-ac -screen 0 1280x1024x24" The resolution part of my video is 1920x1080x24

these are the input mp4 files https://drive.google.com/open?id=1SR5_yNjSj97IUW0Uq_hqPRVKmjVe4uWq https://drive.google.com/open?id=1GWfLcEUf8FZnasVBvkz5To6P-dl5bCef https://drive.google.com/open?id=1N3Hyy3bviO98gWIYLjfawQNB_O45tsaR

javeedrahman commented 5 years ago

I have tried this commands

ffmpeg -i app/media/2/output/1/2105_output.mp4 -y -pix_fmt rgba -start_number 0 "scene-0-%012d.raw"

Here is the output and could you please clarify whether the output was correct?

ffmpeg version 2.8.2 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-39)
  configuration: --tempprefix=/usr/local/src/tmp --enable-gnutls --enable-version3 --enable-gpl --enable-nonfree --enable-shared --enable-postproc --enable-avfilter --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-pthreads --enable-libfreetype --enable-libfontconfig --enable-libspeex --extra-cflags=-fPIC --enable-libass
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'app/media/2/output/1/2105_output.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.40.101
  Duration: 00:00:08.17, start: 0.000000, bitrate: 7113 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 6850 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 255 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Output #0, image2, to 'scene-0-%012d.raw':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.40.101
    Stream #0:0(und): Video: rawvideo (RGBA / 0x41424752), rgba, 1920x1080, q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc56.60.100 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
Press [q] to stop, [?] for help
frame=  245 fps= 11 q=-0.0 Lsize=N/A time=00:00:08.16 bitrate=N/A    
video:1984500kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
maksym-plotnikov commented 4 years ago

Same issue here - as far as I can tell I'm having issues during extract-video-frames execution. @transitive-bullshit can You please tell why do You have '-pix_fmt', 'rgba' output option? And are the changes inside https://www.npmjs.com/package/ffmpeg-concat/v/1.0.14 version? UPD: nevermind about version. I found that there were changes about audio :)

maksym-plotnikov commented 4 years ago

Also @transitive-bullshit why you're not using Yours https://github.com/transitive-bullshit/ffmpeg-extract-frames to extract frames? I see there are additional output options regarding fps and '-vsync', 'vfr'? Please can You tell me why do You need them there?

transitive-bullshit commented 4 years ago

@maksym-plotnikov I'm not sure; feel free to create a fork, experiment, and let us know your findings. 😄

capezzbr commented 4 years ago

In my case I'm having a similar issue when the temporary directory gets around 100GB

capezzbr commented 4 years ago

My solution was to invoke concat on a subset of the videos, then invoke concat again on the partial videos. For instance let's say that I have 100 videos, and I decide to process 10 videos at the time, I'll be invoking concat on video 1...10 then 11...20 until 91-100 and this will give me in output exactly 10 partial videos as result. At that point I can invoke concat on the resulting 10 partial videos generating the final video result of concatenating the 100 videos. This will help limit generating the temp files that will later fill up the /tmp directory, root of the issue for me.

capezzbr commented 4 years ago

Actually that didn't work. I've assumed that only the frames necessary for the transition between videos would be processed instead of all the frames. My new solution simply uses an external HD and limits the length of the video

transitive-bullshit commented 4 years ago

@capezzbr see https://github.com/transitive-bullshit/ffmpeg-concat/pull/23 for the approach you're describing.

Both approaches have their pros and cons. In particular, the more optimal approach that touches less frames requires more complex ffmpeg inputs and from lots of experience, ffmpeg tends to become unstable the more complicated your inputs and processing pipeline becomes. That's why it's not the default approach at the moment.

If you want to cut down on the temp space required, you can use the --frame-format png option to store each frame compressed instead of the faster uncompressed raw format that's the default.

transitive-bullshit commented 4 years ago

(or --frame-format jpg should work too)

capezzbr commented 4 years ago

@transitive-bullshit thanks for the context. I'd rather optimize for speed vs space, so I've opted to use an external disk for the temporary frames data. Also, it would be great if https://github.com/transitive-bullshit/ffmpeg-concat/pull/23 could be taken to a mergeable state and used as default way. That will both optimize time and space. Anyways really appreciate you taking the time to build this library, it works pretty well 👏