3

when I used this commond:

C:\Windows\bin\ffmpeg.exe -y -i f:\1.flv -vcodec h264 -s 1280x720 -acodec copy f:\output.mp4

The video output.mp4 information:

General
Complete name                    : F:\output.mp4
Format                           : MPEG-4
Format profile                   : Base Media
Codec ID                         : isom
File size                        : 129 MiB
Duration                         : 10mn 15s
Overall bit rate                 : 1 759 Kbps
Writing application              : Lavf57.14.100

Video
ID                               : 1
Format                           : AVC
Format/Info                      : Advanced Video Codec
Format profile                   : [email protected]
Format settings, CABAC           : Yes
Format settings, ReFrames        : 4 frames
Format settings, GOP             : M=4, N=45
Codec ID                         : avc1
Codec ID/Info                    : Advanced Video Coding
Duration                         : 10mn 15s
Bit rate mode                    : Variable
Bit rate                         : 1 624 Kbps
Width                            : 1 280 pixels
Height                           : 720 pixels
Display aspect ratio             : 16:9
Frame rate mode                  : Constant
Frame rate                       : 25.000 fps
Color space                      : YUV
Chroma subsampling               : 4:2:0
Bit depth                        : 8 bits
Scan type                        : Progressive
Bits/(Pixel*Frame)               : 0.071
Stream size                      : 119 MiB (92%)
Writing library                  : x264 core 148 r2638 7599210
Encoding settings                : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

Audio
ID                               : 2
Format                           : AAC
Format/Info                      : Advanced Audio Codec
Format profile                   : LC
Codec ID                         : 40
Duration                         : 10mn 15s
Bit rate mode                    : Constant
Bit rate                         : 128 Kbps
Channel(s)                       : 2 channels
Channel positions                : Front: L R
Sampling rate                    : 44.1 KHz
Compression mode                 : Lossy
Stream size                      : 9.38 MiB (7%)

So I want delete "Writing library" & "Encoding settings", how to do it?

2

4 Answers 4

2

There is a possibility to do that by putting the command: -x265-params no-info=1

For example:

ffmpeg -i input.mkv -c:v libx265 -b:v 4000k -an -x265-params no-info=1 output.hevc
1

For AVC:

ffmpeg -i INPUT -bsf:v 'filter_units=remove_types=6' -c copy OUTPUT

For HEVC it's more complex, because ffmpeg doen't remove it directly for whatever reason:

ffmpeg -i INPUT -c:v copy -bsf hevc_mp4toannexb source-video.hevc
ffmpeg -i source-video.hevc -i INPUT -map 0 -map 1:a -bsf:v 'filter_units=remove_types=39' -c copy OUTPUT
1

It turns out that the "Writing library" and "Encoding settings" are both simply in a single ASCII string near the start of the file. Here's a simple perl script I wrote to over-write the string with blanks, leaving the rest of the file contents alone. Crude and with limited testing but, apparently, effective. Use at your own risk.

#!/usr/bin/perl
use strict;
use Fcntl qw(SEEK_SET);
my $file = $ARGV[0];
open(my $fh, "+<:raw", $file) or die "$file: open: $!";
my $len = sysread($fh, my $buf, 102400);
die "$file: read: $!" if !defined($len);
die "$file: Too short." if ($len < 1000);
die "$file: No x264/5 parameters found." unless $buf =~ /(?:x265 \(build|x264 [ -]*core) [ -~]{30,}/;
sysseek($fh, $-[0],SEEK_SET) or die "$file: seek: $!";
$len = syswrite($fh, ' ' x ($+[0] - $-[0]));
die "$file: write: $!" if !defined($len);
$len -= $+[0] - $-[0];
die "$file: Failed to fully overwrite ($len bytes short)." if ($len > 0);

put in a file called "x264-265-decomment.pl" and run it with the name of one file you want modified, e.g.,

x264-265-decomment.pl video.mkv
0

Supplementary explanation for "For Fun"'s answer:

AVC streams are grouped using NAL units, and the bitstream filter filter_units removes/passes specific NAL types. In this case the NAL units we want to filter out is the Supplemental enhancement information (SEI) which according to H.264 spec Table 7-1 is the type 6.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .