fluent-ffmpeg / node-fluent-ffmpeg

A fluent API to FFMPEG (http://www.ffmpeg.org)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

no sound h265 to mp4. video by ip web cam

Shablykinm opened this issue · comments

Version information

  • fluent-ffmpeg version: "fluent-ffmpeg": "^2.1.2"
  • ffmpeg version: ffmpeg version - latest by 10.01.2024 "ffmpeg-master-latest-win64-gpl"
  • OS: windows 10

Code to reproduce

const ffmpeg = require('fluent-ffmpeg');
const stream = require('stream');
const MemoryStream = require('memory-stream');
const Writable = require('stream').Writable;

class Converter {
    async wcam265ToMp4(buffer, filename) {
        const fs = require('fs')
        let outStream = new MemoryStream();
        //var outStream = fs.createWriteStream('output.mp4');
        //let bufferStream = new stream.PassThrough();
        return new Promise((resolve, reject) => {
            //console.log(buffer);
            console.log(filename);
            ffmpeg({
                source: stream.Readable.from(buffer, { objectMode: false })
              })
              .addOption('-c:v', 'libx265')
              .addOption('-movflags', 'faststart')
              .addOption('-movflags', 'frag_keyframe+empty_moov')
              .addOption('-f', 'mp4')
              .output(outStream, { end: true })
              .on('error', function (err, stdout, stderr) {
                console.log('Ошибка:', err);
                console.log('Стандартный вывод:', stdout);
                console.log('Стандартный поток ошибок:', stderr);
              })
              .on('end', function () {
                console.log('Закончено!');
                resolve(outStream.toBuffer());
              })
              .run();
        });
    }
}

module.exports = Converter;

(note: if the problem only happens with some inputs, include a link to such an input file)

Expected results

I want to automate the conversion of video from .h265 to mp4 with sound, because the native converter only offers the possibility of individual conversion in manual mode. At the moment, ffmpeg converts without sound.

i have a ip cam. (​http://www.ipcam.xin/).
The camera saves files with the n265 codec to FTP.(format *.265; filename A231210_161400_161414.265)
If you open this file in any of the players, there is no sound.
If you download the Chinese HIPLAYER(​http://www.ipcam.xin/), the video is played with sound.

Response from ffmpeg developers:

They put AAC into H265 SEI, and use invalid temporal_id.
you can:
1、Don't skip those data
2、Add something to ff_h2645_sei_message_decode to extract AAC.
FFmpeg support output multiple kinds of SEI along with AVFrame sidedata after decoding.
It can be a little too late to output AAC after video decoding, if the goal is to do A-V sync. There are other hacking methods to solve it.

Observed results

no sound in video h265 by ip web camera.
is it possible to convert such files using your library?

link to my ticket with video in ffmpeg bug track
https://trac.ffmpeg.org/ticket/10791

thank you!