Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the common commands in ffmpeg

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

ffmpeg commonly used commands, for this problem, this article details the corresponding analysis and solutions, hoping to help more small partners who want to solve this problem to find a simpler and easier way.

I. Foreword

Most of the format conversion tools such as format factory, etc., are used to process ffmpeg, ffmpeg compiled to generate ffmp.exe, ffplay.exe, ffprobe.exe and other executable files, in fact, packaged a number of nifty features, ffprobe view media file header information tools, ffplay tools for playing media files, especially ffmp.exe, powerful media file conversion tools, you can convert any media file, you can also use your own AudioFilter and VideoFlier for processing and editing, For example, some of the following functions.

List supported formats: ffmpeg -formats

Cut a media file: ffmpeg -i input.mp4 -ss 00:00:50.0 -codec copy -t 20 output.mp4

Extract audio files from a video file: ffmpeg -i input.mp4 -vn -acodec copy output.m4a

Mute video, i.e. keep only video: ffmpeg -i input.mp4 -an -vcodec copy output.mp4

Extract video streams from MP4 files Export as naked H264 data: ffmpeg -i output.mp4 -an -vcodec copy -bsf:v h364_mp4toannexb output.h364

MP4 file generation using AAC audio data and H264 video: ffmpeg -i test.aac -i test.h364 -acodec copy -bsf:a aac_adtstoasc -vcodec copy -f mp4 output.mp4

Audio format conversion: ffmpeg -i input.wav -acodec libfdk_aac output.aac

Convert an MP4 file to a GIF: ffmpeg -i input.mp4 -vf scale=100:-1 -t 5 -r 10 image.gif

Since these tools are so awesome, can you consider doing a function to directly call these executable files for processing? Of course, QProcess is on the scene, he can directly call the executable program or directly execute the command, and then be able to intercept the output of printed information, the form of the pipeline read out, so it is very intuitive, you can call the executable file execution, print all the information output.

II. Functional characteristics

Multi-thread real-time playback video stream + local video +USB camera, etc.

Windows+linux+mac support, ffmpeg3 and ffmpeg4 support, 32-bit and 64-bit support.

Multi-thread display image, not card main interface.

Automatically reconnect the webcam.

You can set the border size i.e. offset and border color.

Can set whether to draw OSD label, i.e. label text or picture and label position.

Two OSD positions and styles can be set.

You can set whether to save to a file and file name.

Drag files directly to the ffmpegwidget control for playback.

Support h365 video stream +rtmp and other common video streams.

You can pause and resume playback.

Support single video file storage and timed video file storage.

Customize the top float bar, send a signal notification by clicking, and set whether to enable it.

You can set the screen stretch fill or proportional fill.

Decoding can be set to speed first, quality first, equalization processing.

Screenshots (original images) and screenshots of videos are available.

Video file storage supports bare stream and MP4 files.

Support qsv, dxva2, d3d11va hard decoding.

Support opengl rendering video data, very low CPU usage.

Support embedded linux, cross-compile.

III. Effect Drawing

IV. Related Sites

Domestic website: gitee.com/feiyangqingyun/QWidgetDemo

International website: github.com/feiyangqingyun/QWidgetDemo

Personal homepage: blog.csdn.net/feiyangqingyun

Home Page: www.zhihu.com/people/feiyangqingyun/

Experience address: blog.csdn.net/feiyangqingyun/article/details/97565652

FFmpegTool::FFmpegTool(QObject *parent) : QObject(parent){ //bind signal slots connect(&process, SIGNAL(started()), this, SIGNAL(started())); connect(&process, SIGNAL(finished(int)), this, SIGNAL(finished())); connect(&process, SIGNAL(readyReadStandardOutput()), this, SLOT(readData())); process.setProcessChannelMode(QProcess::MergedChannels);}void FFmpegTool::readData(){ QString data = process.readAllStandardOutput(); emit receiveData(data);}void FFmpegTool::start(const QString &command){ process.start(command);}void FFmpegTool::start(const QString &program, const QStringList &arguments){ process.start(program, arguments);}void FFmpegTool::getMediaInfo(const QString &mediaFile, bool json){ //ffprobe -print_format json -show_streams d:/out.mp4 //Change the executable file path of different platforms to your own QString jsonArg = "-print_format json -show_streams"; QString binFile = qApp->applicationDirPath() + "/ffprobe.exe"; QString cmd = QString("%1 %2 %3").arg(binFile).arg(json ? jsonArg : "").arg(mediaFile); start(cmd);}void FFmpegTool::h364ToMp4ByCmd(const QString &h364File, const QString &aacFile, const QString &mp4File){ if (! QFile(h364File).exists() || mp4File.isEmpty()) { return; } //Please refer to https://www.cnblogs.com/renhui/p/9223969.html for specific parameters. //ffmpeg.exe -y -i d:/1.aac -i d:/1.mp4 -map 0:0 -map 1:0 d:/out.mp4 //-y parameter indicates default yes overwrite file //Change the executable file path of different platforms to your own QString binFile = qApp->applicationDirPath() + "/ffmpeg.exe"; //The following two methods can be used, how convenient to come #if 0 QString cmd = QString("%1 -y -i %2 -i %3 -map 0:0 -map 1:0 %4").arg(binFile).arg(h364File).arg(aacFile).arg(mp4File); start(cmd);#else QStringList args; args

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report