mifi / lossless-cut

The swiss army knife of lossless video/audio editing
GNU General Public License v2.0
24.59k stars 1.22k forks source link

Support for PCM WAV audio format #476

Closed Raffi111 closed 2 years ago

Raffi111 commented 3 years ago

I spend a lot of time to find a perfect cutter software. Your software is nearly perfect! Easy to use, very comfortable and very fast. An at the end without problem with the final video files.

Only one - for me big - issue: It does not support native PCM WAV audio stream.

I can export the file, but always without audio. Only with the video stream. For preview it is possible to generate the audio, but thats not important for me. It is a standard m2ts file from SONY cameras like (HVR-NX5 or PXW-Z90).

Here the meta data for an example file:

_No error

{ "state": { "filePath": "G:\Video_NX5\20200207231109.m2ts", "fileFormat": "mpegts", "externalStreamFiles": [], "mainStreams": [ { "index": 0, "codec_name": "h264", "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10", "profile": "High", "codec_type": "video", "codec_time_base": "1/50", "codec_tag_string": "HDMV", "codec_tag": "0x564d4448", "width": 1920, "height": 1080, "coded_width": 1920, "coded_height": 1088, "has_b_frames": 1, "sample_aspect_ratio": "1:1", "display_aspect_ratio": "16:9", "pix_fmt": "yuv420p", "level": 40, "chroma_location": "left", "field_order": "tt", "refs": 1, "is_avc": "false", "nal_length_size": "0", "id": "0x1011", "r_frame_rate": "50/1", "avg_frame_rate": "25/1", "time_base": "1/90000", "start_pts": 100800, "start_time": "1.120000", "duration_ts": 92370600, "duration": "1026.340000", "bits_per_raw_sample": "8", "disposition": { "default": 0, "dub": 0, "original": 0, "comment": 0, "lyrics": 0, "karaoke": 0, "forced": 0, "hearing_impaired": 0, "visual_impaired": 0, "clean_effects": 0, "attached_pic": 0, "timed_thumbnails": 0 } }, { "index": 1, "codec_name": "pcm_bluray", "codec_long_name": "PCM signed 16|20|24-bit big-endian for Blu-ray media", "codec_type": "audio", "codec_time_base": "1/48000", "codec_tag_string": "HDMV", "codec_tag": "0x564d4448", "sample_fmt": "s16", "sample_rate": "48000", "channels": 2, "channel_layout": "stereo", "bits_per_sample": 0, "id": "0x1100", "r_frame_rate": "0/0", "avg_frame_rate": "0/0", "time_base": "1/90000", "start_pts": 93600, "start_time": "1.040000", "duration_ts": 92383200, "duration": "1026.480000", "bit_rate": "1536000", "disposition": { "default": 0, "dub": 0, "original": 0, "comment": 0, "lyrics": 0, "karaoke": 0, "forced": 0, "hearing_impaired": 0, "visual_impaired": 0, "clean_effects": 0, "attached_pic": 0, "timed_thumbnails": 0 } } ], "copyStreamIdsByFile": { "G:\Video_NX5\20200207231109.m2ts": { "0": true, "1": true } }, "cutSegments": [ { "start": 0, "end": 84.96 } ], "fileFormatData": { "filename": "G:\Video_NX5\20200207231109.m2ts", "nb_streams": 2, "nb_programs": 1, "format_name": "mpegts", "format_long_name": "MPEG-TS (MPEG-2 Transport Stream)", "start_time": "1.040000", "duration": "1026.480000", "size": "3060019200", "bit_rate": "23848641", "probescore": 50 }, "rotation": 360, "shortestFlag": false } }

Is it possible to add support for this audio stream?

mifi commented 3 years ago

Please try the experimental checkbox in settings, and try different output formats. (e.g. MOV, MP4, MKV, TS)

Raffi111 commented 3 years ago

Hi, thank you for your answer, but your tips dosen't help. Exorting in any format is without audio.

mifi commented 3 years ago

I found this: https://forum.doom9.org/showthread.php?t=174718

It seems that your file uses a codec pcm_bluray that ffmpeg is not able to encode or output at all (and probably never will be.)

I think you can solve this by extracting all streams/tracks, then use handbrake or FFMPEG or similar to convert the audio file to PCM. Then merge the streams again in losslesscut (drag drop the new file into losslesscut with the old file open). I added a feature request here: #372

mifi commented 3 years ago

You can also probably convert the audio using

ffmpeg -i G:/Video_NX5/20200207231109.m2ts -vn output_audio.wav

then import the resulting wav back into your video in losslesscut

mifi commented 2 years ago

does exporting audio track and then converting it to wav using the above command work? then re-introduce the wav file in losslesscut and output to MOV.