Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Stream video to stdout #272

Closed
acheong08 opened this issue Jul 20, 2024 · 6 comments
Closed

Feature request: Stream video to stdout #272

acheong08 opened this issue Jul 20, 2024 · 6 comments

Comments

@acheong08
Copy link

Similar to ffmpeg -i mp4 somefile.mp4 -. This would make integrating it a bit easier in some cases (e.g. streaming to pyatv)

@soreau
Copy link
Collaborator

soreau commented Jul 20, 2024

See this issue.

@soreau soreau closed this as completed Jul 20, 2024
@soreau
Copy link
Collaborator

soreau commented Jul 20, 2024

Also, this is another way:

wf-recorder -o DP-2 -f pipe:99 -m matroska -c libx264 99>&1 >&2 | mpv -

You probably will need to change the output name (-o option) or omit it in the case of single output.

@acheong08
Copy link
Author

Hmm the format doesn't seem to be accepted. Is there a way I can pass this into ffmpeg & output as mp4?

@acheong08
Copy link
Author

acheong08 commented Jul 21, 2024

Ok I found the reason:
wf-recorder -f pipe:1 -m matroska -c libx264 > out.mpv

acheong@fish ~/P/airplay [255|183]> head out.mpv
selected region 0,0 0x0
Setting codec option: crf=20
Setting codec option: preset=ultrafast
Setting codec option: tune=zerolatency
Using video filter: null
MSIfSMSTkSSTSpbIfk*ױ[email protected]?
|ƕ#[email protected]ׁsň5K"undV_MPEG4/ISO/AVCкUUc>g>#x@!PhT!sscgȚEENCODERDLavf60.16.100Cu+[w+]Y,x264 - core 164 r3108 31e19f9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2023 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=6 threads=8 lookahead_threads=8 sliced_threads=1 slices=8 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=20.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0{/e:$Pmy<O'Yoo͟oe?r'<OwGT0>;hi#9-ix2]13.g|QdcLq(S9L@\N֘I2$[/e;&_g>#:z7}y3>?<azցkX0nm #"T~

I'm a bit confused by the pipes & how to remove the logs/info

Edit:

wf-recorder -m rawvideo -f /dev/stdout <<< 'Y' 2>/dev/null | ffmpeg -i pipe:0 -c:v libx264 -preset fast -crf 23 -f 
mp4 out.mp4

[in#0 @ 0x564514ef0280] Error opening input: Invalid data found when processing input
Error opening input file pipe:0.
Error opening input files: Invalid data found when processing input

I'm guessing because taking from pipe0 includes the logs

Edit 2:
Copying verbatim:

$ wf-recorder -f pipe:99 -m matroska -c libx264 99>&1 >&2 > out.mpv

$ cat out.mpv 
selected region 0,0 0x0
Setting codec option: crf=20
Setting codec option: preset=ultrafast
Setting codec option: tune=zerolatency
Using video filter: null

The rest of the output goes to the terminal...

@soreau
Copy link
Collaborator

soreau commented Jul 21, 2024

Make sure you're using latest wf-recorder with this commit.

@acheong08
Copy link
Author

Thanks! I got it working :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants