Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
30th November 2019, 08:35 | #1 | Link |
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,277
|
Changing PAR in H.264 bitstream using FFmpeg
Using a file named 'h264_par_1.mp4' with the following characteristics:
h264_par_1 had: Sampled_Width : 640 Sampled_Height : 352 Pixel aspect ratio : 1.000 <- Display aspect ratio : 1.818 Display aspect ratio : 16:9 one can use: Code:
ffmpeg -y -i "E:\Output\h264_par_1.mp4" -map 0:0 -vcodec copy -an -sn -bsf:v h264_metadata=sample_aspect_ratio=2 "E:\Output\h264_par_2.mp4" to change the PAR from 1 to 2. h264_par_2 has: Sampled_Width : 640 Sampled_Height : 352 Pixel aspect ratio : 2.000 <- Display aspect ratio : 3.636 Display aspect ratio : 3.636 Problem is if the input stream has no PAR data like 'Attica The Movie - Trailer By Brass': (which I uploaded to my GoogleDrive Width : 1280 Width : 1 280 pixels Height : 720 Height : 720 pixels Pixel aspect ratio : 1.000 Display aspect ratio : 1.778 Display aspect ratio : 16:9 note: MediaInfo shows no Sampled Width/Height Code:
ffmpeg -y -i "F:\TestClips&Co\files\MPEG-4 H.264\Attica The Movie - Trailer By Brass.mp4" -map 0:0 -vcodec copy -an -sn -bsf:v h264_metadata=sample_aspect_ratio=2 "E:\Output\test.mp4" Code:
[AVBSFContext @ 000001bcad3b5b00] rbsp_alignment_zero_bit out of range: 1, but must be in [0,0]. [AVBSFContext @ 000001bcad3b5b00] Failed to read unit 0 (type 7). [AVBSFContext @ 000001bcad3b5b00] Failed to read extradata. Error initializing bitstream filter: h264_metadata -> Does anyone know a way to change the PAR of such a stream without reencoding (preferably with ffmpeg)? Cu Selur Last edited by Selur; 30th November 2019 at 08:37. |
Thread Tools | Search this Thread |
Display Modes | |
|
|