AirenSoft / OvenMediaEngine

OvenMediaEngine (OME) is a Sub-Second Latency Live Streaming Server with Large-Scale and High-Definition. #WebRTC #LLHLS
https://airensoft.com/ome.html
GNU Affero General Public License v3.0
2.57k stars 1.06k forks source link

LLHLS Dump broken in 0.16.2 #1465

Closed the-real-rusty-shackleford closed 10 months ago

the-real-rusty-shackleford commented 11 months ago

Starting in 0.16.2, LLHLS dump results in .m4s files with a size of 0 bytes.

Minimum Example

Files

Server.xml

<?xml version="1.0" encoding="UTF-8" ?>

<Server version="8">
    <Name>OvenMediaEngine</Name>
    <!-- Host type (origin/edge) -->
    <Type>origin</Type>
    <!-- Specify IP address to bind (* means all IPs) -->
    <IP>*</IP>
    <PrivacyProtection>false</PrivacyProtection>
    <!-- 
    To get the public IP address(mapped address of stun) of the local server. 
    This is useful when OME cannot obtain a public IP from an interface, such as AWS or docker environment. 
    If this is successful, you can use ${PublicIP} in your settings.
    -->
    <StunServer>stun.ovenmediaengine.com:13478</StunServer>

    <Modules>
        <LLHLS>
            <Enable>true</Enable>
        </LLHLS>
    </Modules>

    <!-- Settings for the ports to bind -->
    <Bind>
        <!-- Enable this configuration if you want to use API Server -->
        <Managers>
            <API>
                <Port>8081</Port>
                <WorkerCount>1</WorkerCount>
            </API>
        </Managers>
        <Providers>
            <!-- Pull providers -->
            <RTSPC>
                <WorkerCount>1</WorkerCount>
            </RTSPC>
            <OVT>
                <WorkerCount>1</WorkerCount>
            </OVT>
            <!-- Push providers -->
            <RTMP>
                <Port>1935</Port>
                <WorkerCount>1</WorkerCount>
            </RTMP>
        </Providers>

        <Publishers>
            <LLHLS>
                <Port>3333</Port>
                <WorkerCount>1</WorkerCount>
            </LLHLS>
        </Publishers>
    </Bind>
    <Managers>
        <Host>
            <Names>
                <Name>*</Name>
            </Names>
        </Host>
        <API>
            <AccessToken>test:test</AccessToken>
            <CrossDomains>
                <Url>localhost</Url>
            </CrossDomains>
        </API>
    </Managers>
    <VirtualHosts>
        <VirtualHost>
            <Name>default</Name>

            <Host>
                <Names>
                    <Name>*</Name>
                </Names>
            </Host>

            <!-- Settings for applications -->
            <Applications>
                <Application>
                    <Name>app</Name>
                    <!-- Application type (live/vod) -->
                    <Type>live</Type>
                    <OutputProfiles>
                        <OutputProfile>
                            <Name>bypass_stream</Name>
                            <OutputStreamName>${OriginStreamName}</OutputStreamName>

                            <Encodes>
                                <Video>
                                    <Name>bypass_video</Name>
                                    <Bypass>true</Bypass>
                                </Video>
                                <Audio>
                                    <Name>bypass_audio</Name>
                                    <Bypass>true</Bypass>
                                </Audio>
                            </Encodes>
                        </OutputProfile>
                    </OutputProfiles>
                    <Providers>
                        <RTMP />
                    </Providers>
                    <Publishers>
                        <AppWorkerCount>1</AppWorkerCount>
                        <StreamWorkerCount>1</StreamWorkerCount>
                        <LLHLS>
                            <OriginMode>true</OriginMode>
                            <ChunkDuration>0.5</ChunkDuration>
                            <PartHoldBack>1.5</PartHoldBack>
                            <SegmentDuration>6</SegmentDuration>
                            <SegmentCount>10</SegmentCount>
                            <CrossDomains>
                                <Url>*</Url>
                            </CrossDomains>
                        </LLHLS>
                    </Publishers>
                </Application>
            </Applications>
        </VirtualHost>
    </VirtualHosts>
</Server>

data-dump.json

{
  "outputStreamName": "test",
  "id": "6s6x4rZ8aWk9",
  "playlist": ["llhls.m3u8"],
  "outputPath": "/tmp/ome_vod/test"
}

run.sh

mkdir -p ./data/vod

docker image pull airensoft/ovenmediaengine:0.16.2
docker image pull jrottenberg/ffmpeg:4.4-alpine

docker container rm ome-test --force
docker container rm ffmpeg-test --force

echo "Starting OME..."

docker run --rm -d \
  --name ome-test \
  -p 1935:1935 \
  -p 8081:8081 \
  -v ./conf:/opt/ovenmediaengine/bin/origin_conf \
  -v ./data/vod:/tmp/ome_vod \
  airensoft/ovenmediaengine:0.16.2

echo "Starting ffmpeg..."
sleep 5

docker run --rm -d --name ffmpeg-test -v $(pwd):$(pwd) jrottenberg/ffmpeg:4.4-alpine \
  -re \
  -stream_loop \
  -1 \
  -i $(pwd)/test.mp4 \
  -an -c:v libx264 \
  -preset fast \
  -f flv rtmp://host.docker.internal:1935/app/test \

echo "Trying to start dump..."

while curl \
  -s \
  -X POST \
  -H "Content-Type: application/json" \
  -d @data-dump.json \
   http://test:test@localhost:8081/v1/vhosts/default/apps/app/streams/test:startHlsDump | grep 404 > /dev/null
do
  sleep 1
done

echo "Dump started."

Steps

  1. Place the above Server.xml into ./conf/Server.xml
  2. Place the above data-dump.json and run.sh into ./.
  3. Place an mp4 file into ./ and call it test.mp4.
  4. Run run.sh.
  5. After the dump starts, run ls -l ./data/vod/test and observe that the only video segment with data is the one called init_0_video_test_llhls.m4s. All other segments are 0 bytes in size (e.g. seg_0_0_video_test_llhls.m4s).
getroot commented 10 months ago

I reproduced this problem. This is a regression bug. I will fix this soon.

getroot commented 10 months ago

This is fixed in 0.16.3. Please check if your issue has been resolved as well.

the-real-rusty-shackleford commented 10 months ago

It's working in 0.16.3. Thanks!