29 Commits

Author SHA1 Message Date
Murph Finnicum
f1cb66b663
Use ffmpeg native options to do scaling and padding math (#34)
* Use ffmpeg native options to do scaling and padding math

* whitespace
2020-12-31 15:19:16 +01:00
Fabian Weik
7a44de2862 fix typos 2020-11-20 12:29:32 +01:00
Fabian Weik
e775e8707b enable recording to output 2020-11-20 12:23:15 +01:00
Fabian Weik
30ac3b714d add option to change the window title (default: reStream) 2020-11-20 12:14:45 +01:00
Rien Maertens
bea1581257
Fix formatting 2020-05-06 14:47:37 +02:00
Rien Maertens
a1b14bdf41
Measure troughput with -t 2020-05-06 14:43:23 +02:00
Rien Maertens
e680dd5531
Set pixel format to rgb565le 2020-04-18 16:17:42 +02:00
beardhatcode
e687816421 Add video4linux2 support 2020-04-14 10:59:49 +02:00
Rien Maertens
088d3732c4
Add examples to usage info 2020-04-07 11:48:46 +02:00
Mattéo Delabre
ab6fa11982
Fix formatting 2020-04-07 11:21:10 +02:00
Mattéo Delabre
3609b990ff
Store extra ffmpeg arguments in $@ 2020-04-07 11:17:45 +02:00
Mattéo Delabre
0c707af239
Merge branch 'master' into specify-output 2020-04-07 10:55:20 +02:00
Mattéo Delabre
d0323daef5
Replace arrays with variable substitutions for POSIX compliance
Co-Authored-By: Rien <rien.maertens@posteo.be>
2020-04-07 10:48:51 +02:00
Rien Maertens
154d15b890
Apply shellcheck and shfmt 2020-04-03 12:15:53 +02:00
Mattéo Delabre
4344903438
Fix recorded videos playing back too fast
Use the `setpts` video filter to set each frame’s presentation timestamp
to the time it is received by the encoder.
See <https://ffmpeg.org/ffmpeg-filters.html#Examples-141>.
2020-04-03 11:28:42 +02:00
Mattéo Delabre
49f20074f0
Allow choosing the video output
Instead of simply playing back the frames through `ffplay`, I thought it
might be interesting to be able to record the sequence to a video file
or to use it as part of a stream.

I have in mind the use case of making educational videos/live streams
where the tablet can be used as a kind of remote blackboard by teachers,
which is especially relevant currently. But there are certainly other
use cases!

Changes
=======

This commit adds two new options to that effect:

* `-o --output`: Path of the output as understood by `ffmpeg` (usually a
file name). If this is `-` (as it is by default), the existing behavior
of playing the stream through `ffplay` is restored.

* `-f --format`: When recording to an output, this option can be used to
force the encoding format. If this is `-` (again, the default),
`ffmpeg`’s auto format detection is used (based on the file extension).

Because of the possible confusion between the newly added `--output`
option and the existing `--destination` option for specifying the source
address, I suggest renaming the `--destination` option to `--source`
(this is implemented in this commit).

Examples
========

Record to a file
----------------

```sh
./reStream.sh -o remarkable.mp4
```

Caveat: The recorded file plays back too fast.
I am not sure how to fix this.

Create an UDP MPEG-TS stream
----------------------------

```sh
./reStream.sh -o "udp://127.0.0.1:1234" -f "mpegts"
```

This sends frames over UDP to the specified port using the MPEG-TS
format (see <https://trac.ffmpeg.org/wiki/StreamingGuide>). This stream
can then be connected, for example, to OBS for live streaming (see
<https://connect.ed-diamond.com/Linux-Pratique/LP-096/Enrichir-sa-diffusion-de-contenus-multimedias-avec-OBS>
in French).
2020-04-02 20:54:11 +02:00
Mattéo Delabre
ac981508f7
Fix incorrect handling of flags
Previously, arguments were examined by a for loop, but this loop is not
affected by the `shift` commands executed inside of it.

Because the loop always advances one argument further on each iteration,
this bug goes unnoticed with the `--portrait` option (`shift` is called
once, which matches the behavior of the loop). However, handling of the
`--destination` argument is broken because of that (`shift` is called
twice but the loop only advances one argument).

This commit replaces the `for` loop by a `while` loop which always
examines the next argument and properly takes `shift`s into account.
This is based on the following SO answer:
<https://stackoverflow.com/a/7069755/3452708>
2020-04-02 16:17:21 +02:00
Rien Maertens
382944058e
Add parameters to README, ssh timeout to 1s
Changed the README to reflect the command line options added with
bcf62e3. Also incorporates the SSH timeout of 1 second added by the
initial PR (#10).

Co-authored-by: Aaron David Schneider <aaron.david.schneider@gmail.com>
2020-04-02 14:20:48 +02:00
Aaron David Schneider
8465062425 change name to -d 2020-04-02 10:23:58 +02:00
Aaron David Schneider
1f63880a8e add command-line options 2020-04-01 16:51:01 +02:00
Robbert Gurdeep Singh
0adb3e4fdc Add -p flag for portrait 2020-03-31 15:25:30 +02:00
Rien Maertens
8ca1557e7b
Replace which zstd by which lz4 (forgotten)
Fixes #5. Thanks @chkgk!
2020-03-18 16:19:12 +01:00
Rien Maertens
9f6ba5dd1d
Use lz4 instead of zstd, add prebuilt static library 2020-03-17 23:44:55 +01:00
Rien Maertens
d0c5ffe9e1
Search for zstd in home directory
This is possibly a solution for #2.
2020-03-12 08:29:19 +01:00
Rien Maertens
eb034a63bd
Better documentation 2020-03-12 00:17:13 +01:00
Rien Maertens
b638810082
Use the default SSH host location, also test if zstd is present on host 2020-03-02 09:34:16 +01:00
Rien Maertens
98709fc0c4
Fix landscape_param 2020-02-24 09:30:12 +01:00
Rien Maertens
7558b0935a
Graceful fallback to gzip if zstd is not present 2020-02-12 14:47:52 +01:00
Rien Maertens
b52f9afc28
Create reStream.sh 2020-02-12 13:13:14 +01:00