Skip to content

Commit

Permalink
version 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DevoutPrayer committed Apr 15, 2021
1 parent 047e2ed commit 31fd7c6
Show file tree
Hide file tree
Showing 249 changed files with 30,913 additions and 4 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This is a basic workflow to help you get started with Actions

name: Ubuntux64

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:

pull_request:


# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
#拉取源码
- uses: actions/checkout@v2
with:
fetch-depth: 1
#aarch64
- name: install aarch64
shell: sh
run: |
wget https://github.com/UWVG/aarch64-none-linux-gnu/archive/refs/heads/master.zip
unzip master.zip
- name: make
shell: sh
run: make cross-compile="1"
- uses: actions/upload-artifact@v2
with:
name: streamer
path: streamer
# tag 上传Release
- name: uploadRelease
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: streamer
asset_name: streamer
tag: ${{ github.ref }}
overwrite: true
body: "This is auto-generated by Github Actions."
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
Expand Down
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
#
ifdef cross-compile
CC := aarch64-none-linux-gnu-master/bin/aarch64-none-linux-gnu-gcc
CFLAGS := -I rkmpp/inc -I ffmpeg/inc -w
LDFLAGS := -L rkmpp/lib -L ffmpeg/lib -lrockchip_mpp -lavformat -lavcodec -lavutil -lpthread -Wl,-rpath ffmpeg/lib
else
CC := aarch64-linux-gnu-gcc
CFLAGS := $(shell pkg-config --cflags rockchip_mpp) -w
LDFLAGS := $(shell pkg-config --libs rockchip_mpp) -lavformat -lavcodec -lavutil
endif

m_streamer : streamer.o rtmp.o v4l2.o mpp.o
$(CC) -o streamer streamer.o rtmp.o v4l2.o mpp.o $(LDFLAGS)
streamer.o : streamer.c
$(CC) -c $(CFLAGS) streamer.c
rtmp.o : rtmp.c
$(CC) -c $(CFLAGS) rtmp.c
v4l2.o : v4l2.c
$(CC) -c $(CFLAGS) v4l2.c
mpp.o : mpp.c
$(CC) -c $(CFLAGS) mpp.c


all : m_streamer
clean :
rm *.o
40 changes: 38 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,38 @@
# streamer
transform camera stream into h.264 stream via rk3399mpp
# Streamer
![GPL License](https://img.shields.io/github/license/DevoutPrayer/streamer) ![size](https://img.shields.io/github/repo-size/DevoutPrayer/streamer)

Develop on firefly RK3399 board and publish camera data into RTMP server.
# Dependents
1. ffmpeg(avformat avcodec avutil)
2. rkmpp
3. nginx rtmp server(optional) [[install reference]](https://blog.csdn.net/qq_32739503/article/details/83064132)
# How to use
*on-board compile*
```
git clone [email protected]:DevoutPrayer/streamer
cd streamer
make
./streamer /dev/video0 rtmp://rtmp_server_addr/live/room
```
*cross compile*
```
git clone [email protected]:DevoutPrayer/streamer
cd streamer
wget https://github.com/UWVG/aarch64-none-linux-gnu/archive/refs/heads/master.zip
unzip master.zip
make cross-compile="1"
```
clone this project,checkout into one branch,make and run
# Releases:
*Streamer v1.0(@a59906c)*
- get video data from camera through v4l2 libs
- encode video raw data into h264 format via rk_mpp libs
- now it can only support video raw data
- jpeg format data should be decode before sending into encoder
- mux the h264 flow into flv and send it via ffmpeg libs

# How to contribute
1. Fork this branch.
2. Commit your changes.
3. Send pull requests.

36 changes: 36 additions & 0 deletions ffmpeg/inc/libavcodec/ac3_parser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* AC-3 parser prototypes
* Copyright (c) 2003 Fabrice Bellard
* Copyright (c) 2003 Michael Niedermayer
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef AVCODEC_AC3_PARSER_H
#define AVCODEC_AC3_PARSER_H

#include <stddef.h>
#include <stdint.h>

/**
* Extract the bitstream ID and the frame size from AC-3 data.
*/
int av_ac3_parse_header(const uint8_t *buf, size_t size,
uint8_t *bitstream_id, uint16_t *frame_size);


#endif /* AVCODEC_AC3_PARSER_H */
37 changes: 37 additions & 0 deletions ffmpeg/inc/libavcodec/adts_parser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef AVCODEC_ADTS_PARSER_H
#define AVCODEC_ADTS_PARSER_H

#include <stddef.h>
#include <stdint.h>

#define AV_AAC_ADTS_HEADER_SIZE 7

/**
* Extract the number of samples and frames from AAC data.
* @param[in] buf pointer to AAC data buffer
* @param[out] samples Pointer to where number of samples is written
* @param[out] frames Pointer to where number of frames is written
* @return Returns 0 on success, error code on failure.
*/
int av_adts_header_parse(const uint8_t *buf, uint32_t *samples,
uint8_t *frames);

#endif /* AVCODEC_ADTS_PARSER_H */
Loading

0 comments on commit 31fd7c6

Please sign in to comment.