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. |
![]() |
#1 | Link |
Registered User
Join Date: May 2009
Location: Belgium
Posts: 1,741
|
Modify h264 resolution in header without re-encoding
Hi,
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) ; https://superuser.com/questions/1298...recorded-strea 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 ; https://ffmpeg.org/ffmpeg-bitstream-...4_005fmetadata 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. |
![]() |
![]() |
![]() |
#2 | Link |
Registered User
Join Date: May 2009
Location: Belgium
Posts: 1,741
|
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). |
![]() |
![]() |
![]() |
#3 | Link |
Registered User
Join Date: Jul 2008
Posts: 527
|
The -aspect option of ffmpeg will change the display aspect ratio but you need to remux to MP4:
Code:
ffmpeg -i input.flv -aspect 1280:720 -c copy output.mp4 |
![]() |
![]() |
![]() |
#5 | Link |
Registered User
Join Date: Aug 2013
Posts: 181
|
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].) |
![]() |
![]() |
![]() |
#6 | Link |
Registered User
Join Date: May 2009
Location: Belgium
Posts: 1,741
|
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. |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|