Always record in mp4

Howdy, currently, when doing tests with all sorts of SDKs, we have noticed that JS/iOS SDKs record video in mp4 format. However, Android SDK records in webm. Can make sure Android records in mp4 too?

We tried to strip codecs, when we strip vp8 - the video is recorded in flv. When we strip vp8 and flv - the video is still recorded in flv.

Thanks,
P
 

Max

Administrator
Staff member
Good day.
WCS supports the following recording containers (see Stream recording doc):
  • MP4 for H.264 + AAC codecs
  • WebM for VP8 + Vorbis codecs
  • TS for H.264 + ADTS
  • MKV (since WCS build 5.2.1190)
By default, the container is set automatically depending on codec published: MP4 for H264, webm for VP8. Seems like Android device you test does not support H264 codec on system level (this codec is implemented only in a certain applications like Chrome browser). So you should transcode stream on server from VP8 to H264
Code:
POST /rest-api/transcoder2/startup HTTP/1.1
HOST: localhost:8081
content-type: application/json
content-length: 242
 
{
    "uri": "transcoder2://tcode2",
    "localStreamName": "testH264",
    "remoteStreamName": "testVP8",
    "encoder": {
      "keyFrameInterval": 60,
      "fps": 30,
      "bitrate": 1000,
      "audioRate": 44100,
      "audioBitrate": 64000
      "audioCodec": "mpeg4-generic",
      "videoCodec": "H264"
    }
}
and then record it, but this requires a lot of server CPU and RAM.
Another option is stream recording file post processing by ffmpeg on the server, using on_record_hook.sh script: Record files handling script
 
Thanks for the answer - we will most likely go with post-processing using ffmpeg. With that - is there a way the "media" symlink can point to a folder outside wcs? We have tried doing

- vod-live://test.mp4 - works good with "media" symlink pointing to /usr/local/FlashphonerWebCallServer/records/ and file residing in records/test.mp4
- vod-live://my/test.mp4 - works good with "media" symlink pointing to /usr/local/FlashphonerWebCallServer/records/ and file residing in records/my/test.mp4

However, when we point the "media" symlink to, for example /home/username/streams/ - nothing seems to be working.
 

Max

Administrator
Staff member
Please use media_dir parameter instead of symlink:
Code:
media_dir=/opt/media
Also please make sure that flashphoner user has enough privileges to the media folder
Code:
sudo chmod o+rw /opt/media
Another option is to launch WCS as root. In latest builds, change the following parameter in /usr/local/FlashphonerWebCallServer/bin/setenv.sh
Code:
WCS_NON_ROOT=true
to
Code:
WCS_NON_ROOT=false
 
Many thanks - it worked. I'm not a pro in Linux, but only the following setup worked:
1. media_dir = /opt/folder
2. sudo chmod o+rw /opt/folder
3. WCS_NON_ROOT=false
If I excluded any of the following steps - WCS won't even start.
 

Max

Administrator
Staff member
Please update WCS to the latest build 5.2.1219 and check again. If the issue still reproducing, try to fix the permissions with command
Code:
sudo /usr/local/FlashphonerWebCallServer/bin/webcallserver set-permissions
and restart WCS.
 
Top