bytedeco/javacv

Problem with webm streaming

Open

#342 opened on 2016年2月29日

GitHub で見る
 (13 comments) (0 reactions) (0 assignees)Java (1,583 forks)batch import
bughelp wanted

Repository metrics

Stars
 (6,985 stars)
PR merge metrics
 (30d に merged PR はありません)

説明

Hello all! Can you help me with this issue? I modify RecordActivity example:

  1. Change ffmpeg_link to "http://192.168.0.143:8890/main.ffm";
  2. Change final int RECORD_LENGTH = 0;
  3. Add setting for recorder:
    recorder = new FFmpegFrameRecorder(ffmpeg_link, imageWidth, imageHeight, 1);
    recorder.setFormat("ffm");
    recorder.setFrameRate(frameRate);
    recorder.setVideoBitrate(400);
    recorder.setPixelFormat(avutil.AV_PIX_FMT_YUV420P);
    recorder.setVideoCodec(avcodec.AV_CODEC_ID_VP9);

    recorder.setSampleRate(sampleAudioRateInHz);
    recorder.setAudioBitrate(64);
    recorder.setAudioChannels(2);
    recorder.setAudioCodec(avcodec.AV_CODEC_ID_VORBIS);
  1. Run ffserver on arch linux with this config file:

HttpPort 8890                      # Port to bind the server to
HttpBindAddress 0.0.0.0
MaxHTTPConnections 2000 
MaxClients 1000
MaxBandwidth 40000             # Maximum bandwidth per client
NoDefaults

<Feed main.ffm>               # This is the input feed where FFmpeg will send
   File /tmp/main.ffm            # video stream.
   FileMaxSize 100M              # Maximum file size for buffering video
   # Launch ffmpeg -f video4linux2 -s 320x240 -thread_queue_size 100 -i /dev/vid$
   #  ACL allow 192.168.0.0
   # Allowed IPs
</Feed>

<Stream live.webm>                      # Output stream URL definition
   Feed main.ffm              # Feed from which to receive video
   Format webm
   # Audio settings
   AudioCodec vorbis
   AudioChannels 2
   AudioBitRate 64             # Audio bitrate
   AudioSampleRate 44100
   #AudioCodec libmp3lame
   # Video settings
   VideoCodec libvpx
   VideoBufferSize 40000
   VideoSize 320x240           # Video resolution
   VideoFrameRate 30           # Video FPS
   AVOptionVideo flags +global_header
   AVOptionVideo cpu-used 8
   AVOptionVideo me_range 16
   AVOptionVideo qdiff 4
   AVOptionVideo qmin 10
   AVOptionVideo qmax 51
   AVOptionVideo quality good
   AVOptionAudio flags +global_header
   PreRoll 1
   # StartSendOnKey
   VideoBitRate 400            # Video bitrate
   PixelFormat yuv420p

</Stream>

<Stream status.html>                    # Server status URL
   Format status
   # Only allow local people to get the status
   ACL allow localhost
   ACL allow 0.0.0.0 0.0.255.255
</Stream>

When i start streaming i found this in server log

Mon Feb 29 12:24:15 2016 [webm @ 0x55680d784f10]Codec for stream 0 does not use global headers but container format requires global headers Mon Feb 29 12:24:15 2016 [webm @ 0x55680d784f10]Codec for stream 1 does not use global headers but container format requires global headers Mon Feb 29 12:24:15 2016 [webm @ 0x55680d784f10]Extradata corrupt. Mon Feb 29 12:24:15 2016 Error writing output header for stream 'live.webm': Operation not permitted

Server version:

ffmpeg version 2.8.5 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.3.0 (GCC)

Jar version in Android Studio:

ffmpeg-2.8.1-1.1

If i change recorder.setFormat("ffm"); to recorder.setFormat("webm"); I don't see stream on server at all. Where I made ​​a mistake? Thanks in advance and sorry for my english.

コントリビューターガイド