Adityo Setyonugroho
Adityo Setyonugroho

Reputation: 897

FFmpeg to Azure Media Services Smooth Streaming Input

I would like to ask about ffmpeg config or command to to mp4 fragment to Azure Media Service live event using smooth streaming / isml protocol. The AMS is not getting any input yet from ffmpeg. This is my current running command:

ffmpeg -f dshow -i video="Webcam" -movflags isml+frag_keyframe -f isml -r 10 http://endpoint/ingest.isml/streaming1

When I am using RTMP with Wirecast is running well.

Any suggestion on ffmpeg command with isml protocol?

Thank you

Upvotes: 0

Views: 1336

Answers (1)

johndeu
johndeu

Reputation: 2512

it is possibly the way you are formatting the ingest URL. The Smooth ingest protocol expects the name of /Streams(yourtrackname-identifier) after it.

See the Smooth ingest specification for details

Here is an FFMPEG command line that I had sitting around that worked for me on a Raspberry Pi at one time

ffmpeg  -i /dev/video1 -pix_fmt yuv420p -f ismv -movflags isml+frag_keyframe  -video_track_timescale 10000000 -frag_duration 2000000 -framerate 30 -r 30  -c:v h264_omx -preset ultrafast -map 0:v:0  -b:v:0 2000k -minrate:v:0 2000k -maxrate:v:0 2000k -bufsize 2500k  -s:v:0 640x360  -map 0:v:0  -b:v:1 500k -minrate:v:1 500k -maxrate:v:1 500k -s:v:1 480x360 -g 60 -keyint_min 60 -sc_threshold 0  -c:a libfaac -ab 48k  -map 0:a? -threads 0 "http://johndeu-nimbuspm.channel.mediaservices.windows.net/ingest.isml/Streams(video)"

Note that i used the following stream identifier - ingest.isml/Streams(video)

Here are a couple more commands that may help.

fmpeg -v debug -y -re -i "file.wmv" -movflags isml+frag_keyframe -video_track_timescale 10000000 -frag_duration 2000000 -f ismv -threads 0 -c:a libvo_aacenc -ac 2 -b:a 20k -c:v libx264 -preset fast -profile:v baseline -g 48 -keyint_min 48 -b:v 200k -s:v 320x240 http://xxxx.userid.channel.mediaservices.windows.net/ingest.isml/Streams(video)

Multi-bitrate encoding and ingest

ffmpeg -re -stream_loop -1 -i C:\Video\tears_of_steel_1080p.mov -movflags isml+frag_keyframe -f ismv -threads 0 -c:a aac -ac 2 -b:a 64k -c:v libx264 -preset fast -profile:v main -g 48 -keyint_min 48 -sc_threshold 0 -map 0:v -b:v:0 5000k -minrate:v:0 5000k -maxrate:v:0 5000k -s:v:0 1920x1080 -map 0:v -b:v:1 3000k -minrate:v:1 3000k -maxrate:v:1 3000k -s:v:1 1280x720 -map 0:v -b:v:2 1800k -minrate:v:2 1800k -maxrate:v:2 1800k -s:v:2 854x480 -map 0:v -b:v:3 1000k -minrate:v:3 1000k -maxrate:v:3 1000k -s:v:3 640x480 -map 0:v -b:v:4 600k -minrate:v:4 600k -maxrate:v:4 600k -s:v:4 480x360 -map 0:a:0

http://.myradarmedia.channel.mediaservices.windows.net/ingest.isml/Streams(stream0^)

EXPLANATION OF WHAT IS GOING ON ABOVE ON THE FFMPEG COMMAND LINE.

ffmpeg 

-re     **READ INPUT AT NATIVE FRAMERATE
-stream_loop -1  **LOOP INFINITE
-i C:\Video\tears_of_steel_1080p.mov   **INPUT FILE IS THIS MOV FILE
-movflags isml+frag_keyframe  **OUTPUT IS SMOOTH STREAMING THIS SETS THE FLAGS
-f ismv  **OUTPUT ISMV SMOOTH
-threads 0  ** SETS THE THREAD COUNT TO USE FOR ALL STREAMS. YOU CAN USE A STREAM SPECIFIC COUNT AS WELL
-c:a aac  ** SET TO AAC CODEC
-ac 2   ** SET THE OUTPUT TO STEREO
-b:a 64k ** SET THE BITRATE FOR THE AUDIO
 -c:v libx264  ** SET THE VIDEO CODEC
-preset fast ** USE THE FAST PRESET FOR X246
 -profile:v main **USE THE MAIN PROFILE
-g 48 ** GOP SIZE IS 48 frames
 -keyint_min 48 ** KEY INTERVAL IS SET TO 48 FRAMES
-sc_threshold 0  ** NOT SURE! 
-map 0:v   ** MAP THE FIRST VIDEO TRACK OF THE FIRST INPUT FILE
-b:v:0 5000k   **SET THE OUTPUT TRACK 0 BITRATE
-minrate:v:0 5000k  ** SET OUTPUT TRACK 0 MIN RATE TO SIMULATE CBR
-maxrate:v:0 5000k  ** SET OUTPUT TRACK 0 MAX RATE TO SIMULATE CBR
-s:v:0 1920x1080  **SCALE THE OUTPUT OF TRACK 0 to 1920x1080. 
-map 0:v  ** MAP THE FIRST VIDEO TRACK OF THE FIRST INPUT FILE
-b:v:1 3000k ** SET THE OUTPUT TRACK 1 BITRATE TO 3Mbps
-minrate:v:1 3000k -maxrate:v:1 3000k  ** SET THE MIN AND MAX RATE TO SIMULATE CBR OUTPU
-s:v:1 1280x720  ** SCALE THE OUTPUT OF TRACK 1 to 1280x720
-map 0:v -b:v:2 1800k  ** REPEAT THE ABOVE STEPS FOR THE REST OF THE OUTPUT TRACKS
-minrate:v:2 1800k -maxrate:v:2 1800k -s:v:2 854x480 
-map 0:v -b:v:3 1000k -minrate:v:3 1000k -maxrate:v:3 1000k -s:v:3 640x480 
-map 0:v -b:v:4 600k -minrate:v:4 600k -maxrate:v:4 600k -s:v:4 480x360 
-map 0:a:0    ** FINALLY TAKE THE SOURCE AUDIO FROM THE FIRST SOURCE AUDIO TRACK.

http://.myradarmedia.channel.mediaservices.windows.net/ingest.isml/Streams(stream0^)

The URL above is part of the output o the command... formatting issue.

Upvotes: 1

Related Questions