FFMpeg FTP output issue, can't output to MP4 format
Solution 1
Some FTP servers truncate files at the position where you write to them. So if muxer is seeking backward and then writing, your file would get truncated at this position. If you really want to use FTP resource as an output, then you probably need to change your FTP server.
Solution 2
ffmpeg cannot put mp4 file directly in ftp server because ffmpeg needs to rewrite mp4 header (moov) everytime with default mp4 options.
However, you can fragment your mp4 file with "-movflags frag_keyframe". With this option, moov is not rewrited.
Could you try with this command ?
ffmpeg.exe -i test.avi -movflags frag_keyframe -f mp4 ftp://127.0.0.1/dumped.mp4
Related videos on Youtube
Jet
The user has hidden all of his information. He cares about privacy. What about you ?
Updated on September 18, 2022Comments
-
Jet almost 2 years
I have a problem with FFMpeg when I want to convert video to MP4, and output to FTP.
Simply try to do this (and it will not work):ffmpeg.exe -i test.avi ftp://127.0.0.1/dumped.mp4
But it works when I convert to FLV using this:
ffmpeg.exe -i test.avi ftp://127.0.0.1/dumped.flv
Can anyone explain why isn't this working/how to do this?
NOTE: I've tried it on different FTP Server software (FileZilla Server, Quick'n'Easy FTP, BabyWeb FTP), so probably it's not a server problem. I created a user with full read/write access privileges, but without success.
UPDATE : Here is FFMpeg console log:
D:\Projects\FFMpeg FTP>ffmpeg -i test.avi ftp://anonymous:[email protected]/dumped.mp4 ffmpeg version N-54362-ge0be3cb Copyright (c) 2000-2013 the FFmpeg developers built on Jul 2 2013 22:15:59 with gcc 4.7.3 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzli b --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libblu ray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --ena ble-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheo ra --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-lib vpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 52. 38.100 / 52. 38.100 libavcodec 55. 18.100 / 55. 18.100 libavformat 55. 11.100 / 55. 11.100 libavdevice 55. 2.100 / 55. 2.100 libavfilter 3. 77.101 / 3. 77.101 libswscale 2. 3.100 / 2. 3.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 3.100 / 52. 3.100 Input #0, avi, from 'hand.avi': Metadata: encoder : Lavf55.11.100 Duration: 00:01:00.87, start: 0.000000, bitrate: 466 kb/s Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 640x480 [SAR 1:1 DAR 4: 3], 30 tbr, 30 tbn, 30 tbc Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, s16p, 128 kb/s [libx264 @ 0246db20] using SAR=1/1 [libx264 @ 0246db20] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64 SlowShuffle [libx264 @ 0246db20] profile High, level 3.0 [libx264 @ 0246db20] 264 - core 133 r2334 a3ac64b - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - ht tp://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subm e=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21, 11 fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 i nterlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 we ightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc =crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 [mp4 @ 036d8820] muxer does not support non seekable output Output #0, mp4, to 'ftp://anonymous:[email protected]/dumped.mp4': Metadata: encoder : Lavf55.11.100 Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 90k tbn, 30 tbc Stream #0:1: Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 128 kb/s Stream mapping: Stream #0:0 -> #0:0 (mpeg4 -> libx264) Stream #0:1 -> #0:1 (mp3 -> libvo_aacenc) Could not write header for output file #0 (incorrect codec parameters ?): Error number -1 occurred
These lines were marked with red color in console (I think these are the most important):
[mp4 @ 036d8820] muxer does not support non seekable output
and
Could not write header for output file #0 (incorrect codec parameters ?): Error number -1 occurred
UPDATE 2: Here are FTP server logs.
1) converting to MP4 (fails)
... REST 0 350 Rest supported. Restarting at 0 SIZE /dumped.mp4 213 566120 disconnected.
2) converting to FLV (works)
... REST 0 350 Rest supported. Restarting at 0 SIZE /dumped.flv 213 566120 PASV 227 Entering Passive Mode (46,241,209,90,204,57) STOR /dumped.flv 150 Connection accepted
UPDATE 3: After noticing this in ffmpeg console log:
[mp4 @ 036d8820] muxer does not support non seekable output
,
I added this parameter-ftp-write-seekable 1
.
Now I see that it converts the file to MP4 without errors in ffmpeg log and I see that file on my FTP server!
But I can't play it (because it's corrupted?). I tried all my media players (no luck).
Here is FFPlay log (not FFMpeg):... libpostproc 52. 3.100 / 52. 3.100 [mov,mp4,m4a,3gp,3g2,mj2 @ 033302e0] moov atom not found dumped.mp4: Invalid data found when processing input= 0B f=0/0
-
Jet over 10 years@LordNeckbeard , But I think that the upper part of the ffmpeg log is not useful. Let me remove it.
-
Jet over 10 yearsMaybe it's bug in FFMpeg? I see it sends FTP "PASV" command and enters passive mode when it converts to FLV (look in my logs). But it doesn't send PASV for MP4.
-