I am using pipes to provide input and to send out output from FFmpeg
The command I use is essentially
ffmpeg -i pipe:0 -f flv pipe:1
I am using a Java program that basically provides an input stream as standard input (pipe:0), FFmpeg converts the video into the required format and sends out to standard output(pipe:1) from where I stream out to my remote location.
My java program revolves around this piece of code, providing input and sending output as an output stream.
Essentially my program does what it is supposed to, however I see that the final output video file is not of the complete duration. It is like 10 sec duration, and my sample video is 21 mins!
When I replace the pipe with an input file and an output file,the output is generated correctly without any issues, when I use pipes the size of the file is still larger compared to original. Just in case if it helps to diagnose.
I need to convert a wide range of codecs, however currently I am testing with an h264 mp4 video to flv format. In fact even if I provide -vcodec copy -acodec copy, it still does not output the full lengtht video
I saw many post having answers that it is basically because pipes are not seekable and sometimes video information is kept at the end of the file. However even if I try to do conversions on a input file formats like flv I still get the same issue. Even when the output is also specified as FLV and provide -vcodec copy -acodec copy
Do I need to provide more info to FFmpeg? has anyone sucessfully done pipe based video conversion ? even for files where media info is at the beginning of the file ?
FFmpeg version SVN-r23418, Copyright (c) 2000-2010 the FFmpeg developers
built on Jun 2 2010 04:12:01 with gcc 4.4.2
configuration: --target-os=mingw32 --enable-runtime-cpudetect --enable-avisynth --enable-gpl --enable-version3 --enable-bzlib --enable-libgsm --enable-libfaad --enable-pthreads --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libmp3lame --enable-libopenjpeg --enable-libxvid --enable-libschroedinger --enable-libx264 --extra-libs='-lx264 -lpthread' --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-librtmp --extra-libs='-lrtmp -lssl -lcrypto -lws2_32 -lgdi32 -lwinmm -lcrypt32 -lz' --arch=x86 --cross-prefix=i686-mingw32- --cc='ccache i686-mingw32-gcc' --enable-memalign-hack
libavutil 50.16. 0 / 50.16. 0
libavcodec 52.72. 1 / 52.72. 1
libavformat 52.67. 0 / 52.67. 0
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.20. 0 / 1.20. 0
libswscale 0.11. 0 / 0.11. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'pipe:0':
major_brand : isom
minor_version : 1
Duration: 00:21:46.63, start: 0.000000, bitrate: N/A
Stream #0.0(und): Video: h264, yuv420p, 512x288 [PAR 1:1 DAR 16:9], 403 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Stream #0.1(und): Audio: aac, 44100 Hz, mono, s16, 47 kb/s
Output #0, flv, to 'pipe:1':
encoder : Lavf52.67.0
Stream #0.0(und): Video: flv, yuv420p, 512x288 [PAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 1k tbn, 25 tbc
Stream #0.1(und): Audio: libmp3lame, 44100 Hz, mono, s16, 64 kb/s
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1