-
Notifications
You must be signed in to change notification settings - Fork 243
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
Add support for stdin and stdout #89
Conversation
chrisn
commented
Apr 19, 2019
- Write status messages to stderr instead of stdout
- Added --input-format and --output-format options
- Changed file I/O code to be able to read/write stdio or files
- Write status messages to stderr instead of stdout - Added --input-format and --output-format options - Changed file I/O code to be able to read/write stdio or files
standard input and write to standard output. For example, the following command | ||
generates a waveform data file by converting a video file using ffmpeg: | ||
|
||
$ ffmpeg -i test.mp4 -f wav - | audiowaveform --input-format wav --output-format dat -b 8 > test.dat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/AudioFileReader.cpp
Outdated
@@ -64,7 +64,7 @@ void AudioFileReader::showProgress(long long done, long long total) | |||
if (percent != percent_) { | |||
percent_ = percent; | |||
|
|||
output_stream << "\rDone: " << percent << "%" << std::flush; | |||
error_stream << "\rDone: " << percent << "%" << std::flush; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the rightful place for progress info however it might be a bit concerning for users who log the stdout for progress. I think you should mention this breaking behaviour in CHANGELOG
LGTM |
Still to do:
|
- Duration calculation - More consistent status messages - Error reporting if unable to perform requested conversion - Test cases for all combinations of file and stdio input and output - Prevent illegal seek error writing WAV output - Remove code duplication in WaveformBuffer
@joneslee85 I think this PR is ready to merge. I'd welcome feedback on this, if you're interested in doing some tests. |
Code looks good. I am going to run few tests locally then come back to you. |
Very interested in this PR, as I'd love the ability to stream directly from AWS S3 into audiowaveform. Awesome work! |
I tried this on an mp3 file, and it didn't seem to work:
Works fine on WAV files though. And when doing |
@ffxsam how would you got about streaming S3 files, signed URLs or boto3 or something else? |
Currently investigating the |
Thanks @chrisn! @raedatoui: Just using the AWS JavaScript SDK. const stream = s3.getObject({ Bucket: 'my-bucket', Key: 'file' }).createReadStream(); Once you have that stream, you can use Node.js |
Version 1.4.0 is now published. Thanks all for your feeback! |
I'm seeing a similar issue issue with FLAC files: |