[FFmpeg-user] Sending dynamically generated ffmpeg output as a byte stream to a client

Amila Perera perera.amila at gmail.com
Tue Jul 1 20:24:29 CEST 2014


I am trying to convert a .mov file to .mp4 and send the converted byte
stream to a client machine.

In order to test if this can be really acquired with ffmpeg I tried the
following command in a shell.

TERMINAL1:
%ffmpeg -i sample_iTunes.mov -vcodec libx264 -crf 35 -pix_fmt yuv420p
-strict -2 -f mp4 "tcp://localhost:8080?listen"

Then in another shell I just wanted to access the stream via tcp with
ffplay.
TERMINAL2:
%ffplay "tcp://localhost:8080"

I get the following error o/p in the TERMINAL1.
-----------
% ffmpeg -i sample_iTunes.mov -vcodec libx264 -crf 35 -pix_fmt yuv420p
-strict -2 -f mp4 "tcp://localhost:8080?listen"
ffmpeg version 2.1.4 Copyright (c) 2000-2014 the FFmpeg developers
  built on Feb 25 2014 08:24:47 with gcc 4.8.2 (GCC) 20131212 (Red Hat
4.8.2-7)
  configuration: --prefix=/usr --bindir=/usr/bin
--datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg
--libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2
-g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
-m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-frei0r
--enable-gnutls --enable-libass --enable-libcdio --enable-libcelt
--enable-libdc1394 --disable-indev=jack --enable-libfreetype
--enable-libgsm --enable-libmp3lame --enable-openal --enable-libopencv
--enable-libopenjpeg --enable-libopus --enable-libpulse
--enable-libschroedinger --enable-libsoxr --enable-libspeex
--enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvpx
--enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter
--enable-avresample --enable-postproc --enable-pthreads --disable-static
--enable-shared --enable-gpl --disable-debug --disable-stripping
--shlibdir=/usr/lib64 --enable-runtime-cpudetect
  libavutil      52. 48.101 / 52. 48.101
  libavcodec     55. 39.101 / 55. 39.101
  libavformat    55. 19.104 / 55. 19.104
  libavdevice    55.  5.100 / 55.  5.100
  libavfilter     3. 90.100 /  3. 90.100
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sample_iTunes.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2005-10-17 22:54:32
  Duration: 00:01:25.50, start: 0.000000, bitrate: 307 kb/s
    Stream #0:0(eng): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D),
yuv420p, 640x480 [SAR 1:1 DAR 4:3], 261 kb/s, 10 fps, 10 tbr, 3k tbn, 25
tbc (default)
    Metadata:
      creation_time   : 2005-10-17 22:54:33
      handler_name    : Apple Video Media Handler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 32000 Hz, mono, fltp,
43 kb/s (default)
    Metadata:
      creation_time   : 2005-10-17 22:54:34
      handler_name    : Apple Sound Media Handler
[libx264 @ 0x19bed20] using SAR=1/1
[libx264 @ 0x19bed20] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1
Cache64
[libx264 @ 0x19bed20] profile High, level 2.2
[libx264 @ 0x19bed20] 264 - core 138 r2363 c628e3b - H.264/MPEG-4 AVC codec
- Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1
ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=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=6 lookahead_threads=1
sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0
constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1
weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=10 scenecut=40
intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=35.0 qcomp=0.60 qpmin=0
qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[mp4 @ 0x199ff20] *muxer does not support non seekable output*
Output #0, mp4, to 'tcp://localhost:8080?listen':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    encoder         : Lavf55.19.104
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021),
yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 90k tbn, 10 tbc (default)
    Metadata:
      creation_time   : 2005-10-17 22:54:33
      handler_name    : Apple Video Media Handler
    Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 32000 Hz, mono,
fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2005-10-17 22:54:34
      handler_name    : Apple Sound Media Handler
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 -> libx264)
  Stream #0:1 -> #0:1 (aac -> aac)
*Could not write header for output file #0 (incorrect codec parameters ?):
Invalid argument*
-------------------------

Am I doing anything wrong here??
Or else is there another way to achieve the same results.
However my requirement is to, convert an .mov to .mp4 on the fly and send
those byte stream to a client pc.

Thank you in advance!




*Amila Perera.*


More information about the ffmpeg-user mailing list