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.


Go Back   Doom9's Forum > Capturing and Editing Video > New and alternative a/v containers

Thread Tools Search this Thread Display Modes
Old 11th May 2022, 08:58   #1  |  Link
Music Fan
Registered User
Join Date: May 2009
Location: Belgium
Posts: 1,745
Modify h264 resolution in header without re-encoding


I recorded a streaming in flv a while ago and the video resolution changed during the streaming.
I achieved to split the file to get 2 files, each with its own resolution, using this method (ffprobe then ffmpeg) ;
I kept the flv container but I can change it if needed.

The problem is that the second file has the same header than the first and I'd like to correct it to make it recognizable by all players.

I can though play it with MPC-HC which opens it directly at its actual resolution, as if header was ignored, but VLC can't : it opens the file at the size of original's header resolution and displays a green image.

MediaInfo does not detect its actual resolution either.

Can ffmpeg correct it ?
Here are informations about metadata but I don't see how to change resolution ;
I tried the option -aspect (on the second flv) but it only added informations in the header about resolution in MediaInfo (thus there is resolution plus original resolution). It didn't make it more playable by VLC.

If I demux the second file in .h264 with ffmpeg, MediaInfo still detects only the original resolution.

I also tried My MP4Box GUI but it seems that only framerate can be modified, not resolution.

Thanks for suggestions

Last edited by Music Fan; 11th May 2022 at 09:08.
Music Fan is offline   Reply With Quote
Old 18th May 2022, 13:25   #2  |  Link
Music Fan
Registered User
Join Date: May 2009
Location: Belgium
Posts: 1,745
If it's not possible, I will re-encode it, while my goal is generally to avoid re-encoding when no modification is done on video.
But I have to admit that x265 compression makes clearly decrease the size compared to x264, thus it becomes useful.

After splitting, I tested a re-encoding of the second part with ffmpeg, it failed : no error message but the video was gray and the original's resolution was kept instead of its actual's.

But it worked with Virtual Dub 2 which opened it directly at the good resolution
I first tested to save it in mkv as is but direct stream copy was refused for this file.

When splitting the original video with ffmpeg, it absolutely has to stay in flv to be readable by VD2 (didn't work in mkv or mp4).
Music Fan is offline   Reply With Quote
Old 19th May 2022, 00:32   #3  |  Link
Registered User
Join Date: Jul 2008
Posts: 538
The -aspect option of ffmpeg will change the display aspect ratio but you need to remux to MP4:

ffmpeg -i input.flv -aspect 1280:720 -c copy output.mp4
Of course replace 1280:720 with the resolution of your video. Split the video first and then apply the command line to the splitted parts.
Brazil2 is offline   Reply With Quote
Old 19th May 2022, 08:30   #4  |  Link
Music Fan
Registered User
Join Date: May 2009
Location: Belgium
Posts: 1,745
Thanks but it doesn't work, the video becomes unplayable, even by MPC-HC while it plays correctly the splitted flv's.
Music Fan is offline   Reply With Quote
Old 25th May 2022, 16:12   #5  |  Link
Registered User
Join Date: Aug 2013
Posts: 192
You might give Avidemux a shot.
Use its 'Copy' options (for both audio & video, i.e., lossless).

Depending on the streams, you may need to output to mp4 (or mkv or avi or...).
(Output to flv itself is only for FLV1 & VP6.)

If output to mp4 (or...) works, you can then copy that out back to flv.
(At which point you again need to see if it still works ;-).)
(ffmpeg -i out.mp4 -c copy out.flv)

And if not Avidemux, then maybe some other utility.
(With Avidemux, I would go with the latest nightly or the 2.7.8 release [rather then the 2.8.0 release].)
therube is offline   Reply With Quote
Old 26th May 2022, 07:53   #6  |  Link
Music Fan
Registered User
Join Date: May 2009
Location: Belgium
Posts: 1,745
Ok, thanks for the suggestion.
I used it years ago but it had some problems, then I discovered ffmpeg which seemed more stable.

Anyway, this problem made me discover x265's efficiency thus if I still have header's problems, I will re-encode.
Music Fan is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 08:01.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.